Perl 6 Cool Perl 6 #88

Types

In Perl 6, values know what kind of thing they are

say 42.WHAT;              # Int
say "foo".WHAT;           # Str

sub answer { return 42 }
say &answer.WHAT;         # Sub

This includes your own classes

class Dog { … }
my $fido = Dog.new();
say $fido.WHAT;           # Dog
Copyright © 2010
http://www.pmichaud.com/2010/pres/