I'm interested in developing such systems for Clojure and have actively researching something considerably more powerful than Chambers/Chen predicate dispatch.
> a rational number between [0.0 - 1.0)
Those are representation errors.
The hard problems that I run into rarely have much to do with representation. The hard problems are knowing when it's okay to add apples and oranges and when it isn't.
That said..., I have an uneasy feeling that trying to do it would end up with a PL/1 type of situation where, depending on your background, you write it with whatever baggage you bring with you, and the language would get large to the point of different types of programmers writing in their own familiar subset of the language.
Or, I'm completely wrong. =)
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.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.
a value
a number
a rational number
a rational number between [0.0 - 1.0)
a rational number between [0.0 - 1.0), and I don't need any more than 30 bits of precision
a rational number between [0.0 - 1.0), and I don't need any more than 30 bits of precision, and please try to optimize for minimum memory usage instead of performance