Luke Palmer wrote: > That's good, because that's what it does. A "range object" in list > context expands into a list, but in scalar context it is there for > smart-matching purposes: > > 3.5 ~~ 3..4 # true > 4 ~~ 3..^4 # false > > etc. > > The only remaining problem is that we have no syntax for ...3, which > doesn't make sense as a list, but does make sense as a range.
So just include a ... prefix operator that's useful for pattern matching in scalar context, but fails if you try to use it in list context. More precisely, cause any range with an indeterminant lower bound to fail if you try to use it in list context; so not only would "loop ...5 {...}" fail, but so would "loop (not 3..4) {...}" or "loop (not 5...) {...}"; but "loop (not ...5) {...}" would work, generating a list of 6, 7, 8, 9, and so on. BTW: where is the behavior in scalar context documented? I don't remember seeing it. (I also seem to recall seeing something about "$a ..^ $b" being equivalent to "$a .. ($b - 1)"; but I could be mistaken. I hope that's not the case, as the only time that it would make sense would be when the both bounds are whole numbers and the range is being used in list context.) -- Jonathan "Dataweaver" Lang