Perl 6 Perl 6 today #61

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 © 2009
http://www.pmichaud.com/2009/pres/