On Sat, 20 Aug 2016 10:24:51 -0700, zef...@fysh.org wrote:
> > (:a..:b).WHICH
> Range|a True..b True
> > (List..Pair).WHICH
> Use of uninitialized value $!min of type List in string context.
> Methods .^name, .perl, .gist, or .say can be used to stringify it to
> something meaningful.  in block <unit> at <unknown file> line 1
> Use of uninitialized value $!max of type Pair in string context.
> Methods .^name, .perl, .gist, or .say can be used to stringify it to
> something meaningful.  in block <unit> at <unknown file> line 1
> Range|..
> 
> Even where it doesn't produce these warnings and an empty
> representation
> of an endpoint, this style of .WHICH is very poor and clash-prone.
> Range.WHICH should apply .WHICH to the endpoint objects.
> 
> -zefram

Unfortunately using the .WHICHs of the endpoints will not be sufficient.

For example "Foo^".."Bar" and "Foo"^.."Bar" would put out the same WHICH.
Since any Str can foil any attempt we make to simply bracket the result,
we have no choice than to either use an escape character quoteish
construct, or prepend a length:

Range|(8)|Str|Foo^..Str|Bar

...we could, however, decide whether or not to do so
by detecting anything in $!min which may jump the rails.

Same problem with Pair, BTW, which already .WHICHs its members:

$ perl6 -e '("Foo|Str|2" => "1").WHICH.say'
Pair|Str|Foo|Str|2|Str|1
$ perl6 -e '("Foo" => "2|Str|1").WHICH.say'
Pair|Str|Foo|Str|2|Str|1

...and given the use of WHICH in hashing, this is more consequential
than it may seem at first glance.

Reply via email to