Aaron Sherman wrote:
2) The spec doesn't put this information anywhere near the definition of the
range operator. Perhaps we can make a note? This was a source of confusion
for me.

My impression is that a "Range" primarily defines an "interval" in terms of 2 endpoint values such that it defines a possibly infinite set values between those endpoints.

For example, 'aa'..'bb' is an infinite sized set that includes every possible character string that starts with the letter 'a', plus every one that starts with the string 'ba'. And so, asking $anysuchstring ~~ 'aa'..'bb' is TRUE.

(Note that for ".." to work, its 2 arguments would need to be of the same type, so that we know which set of rules to follow. Or to be specific, the generic "eqv" operator, or "before" etc would have to be defined that takes both of the ".." arguments as its arguments. Although this might be fuzzed a bit if the spec defines somewhere about automatic casting. For example, if someone said 'foo'..42 then I would expect that to fail.)

A "Range" can also be used in a limited fashion to generate a finite list of values, but that is not its primary purpose, and the "..." operator does that job much better.

3) It seems that there are two competing multi-character approaches and both
seem somewhat valid. Should we use a pragma to toggle behavior between A and
B:

 A: "aa" .. "bb" contains "az"
 B: "aa" .. "bb" contains ONLY "aa", "ab", "ba" and "bb"

I would find A to be the only reasonable answer.

If you want B's semantics then use "..." instead; ".." should not be overloaded for that.

If there were to be any similar pragma, then it should control matters like "collation", or what nationality/etc-specific subtype of Str the 'aa' and 'bb' are blessed into on definition, so that their collation/sorting/etc rules can be applied when figuring out if a particular $foo~~$bar..$baz is TRUE or not.

-- Darren Duncan

Reply via email to