Em Seg, 2009-08-24 às 23:50 +0200, Michael Zedeler escreveu:
> The most elegant solution would be if the data types themselves
> indicated their capabilities.
One thing I think you missed entirely is the fact that the infix:<..>
operator is a multi sub, so it falls to regular dispatch semantics, in a
way that any new class can export its own version of it with the desired
semantics...
> my $range = 1.14 .. 1.82 :by {* + 0.01};
Including mandatory named arguments...
> Another option is to provide a completely different operator for
> constructing Intervals.
The other thing you're missing is that Range is a role, not a class,
which means that any type can behave like a range even if it provides a
completely different behavior, which might include
method list {
fail "This type of Range cannot be used as a list..."
}
daniel