Perl 6 Cool Perl 6 #89

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