Perl 6 Perl 6 today #62

Typed Variables

We can refer to types in our code by name

We can constrain variables to only hold certain types

my Int $x = 42;         # OK, 42 isa Int
$x = 100;               # OK, 100 isa Int
$x = "CHEEZBURGER";     # Error

This also works with user-defined types

Copyright © 2009
http://www.pmichaud.com/2009/pres/