Darren Duncan wrote: > However, I still don't see how one would retrieve the distinction between say > "1..10" and "1^..^10". I suggest that an extra 2 methods such as > .min_is_outside and .max_is_outside (each returns a Bool) could fit the bill, > and in fact since I have Pugs write access I think I'll go make that addition > myself in the above S03 section.
Great. Rakudo currently uses from_exclusive and to_exclusive, but since ranges now always have $.from < $.to, I see no reason to stick with "from" in favor of "min", and "to" in favor of "max". > Now I was going to ask how to represent endpoints that are "whatever" if > "whatever" is orthogonal to type, but then I realized the answer is simply to > use a Whatever object, which is one of the 4 "Undefined types" mentioned in > S02. > > For example, if someone said: > > my $r = $foo..*; > my $min = $r.min; # $foo's value > my $max = $r.max; # Whatever.new() > > Now maybe it would be reasonable for .max to return +Inf if $foo was an Int, > but > I would expect that for any type where $foo doesn't have a concept of > positive-infinity, a * would just be Whatever.new() by default. I'd just say that Range.min and Range.max return exactly what you put into it - (1..*).max should return * (which is a Whatever object), (1..Inf).max should return Inf. Cheers, Moritz