Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

That's a horrible hack indeed :)

Perl 6 does have 'gradual typing' though. You can define a variant:

  my $foo;
or a typed variable:

  my Int $foo;
or a subtype with arbitrary restrictions

  subset OneToTen of Int where { 1 <= $^n <= 10 };
  my OneToTen $foo;
Or... (http://rosettacode.org/wiki/Define_a_primitive_data_type#Per...)

  subset Prime of Int where { $^n > 1 and $^n %% none 2 .. sqrt $^n };
Perl 6 scares me.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: