News for hackers. Stuff that matters.
Re:C++ at Google: Here Be Dragons by zoul on Tuesday May 24, 2011 @06:34AM (#2579339)
You might be interested in the type system of Perl 6:

    subset Filename of Str where { $_ ~~ :f };
Here you define the Filename type as a string that represents an existing path. This particular example is a horrendous hack of course, but the tool looks very interesting. Not sure if this can be used for performance tuning in existing P6 implementations.
Re:C++ at Google: Here Be Dragons by rjh29 on Tuesday May 24, 2011 @07:01AM (#2579389)
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.