On 7/1/07, Amir E. Aharoni <[EMAIL PROTECTED]> wrote:
I got the reply that it is similar to exponentiation of variables in math:

a ** 5 == a * a * a * a * a == aaaaa

It makes sense after it is explained and i do like the rationalization
of the range as a list-like range, instead of the comma, but the **
syntax is rather ugly to my taste. Seeing that the ** quantifier is
not yet implemented anyway, I thought what could replace it, and the
best i could find was <1 .. 3>.

My rationale is this:

* It looks clean.

* It the chapter about Extensible metasyntax (<...>) in S05 most
paragraphs begin by "A leading X means yadda yadda", where X can be:

    * whitespace
    * alphabetic character (not alphanumeric!)
    * ? $ :: @ % { & [ + - . ! ~~

... so numbers are not covered.

* As a side effect, * is a shortcut for <0 .. Inf>, + is a shortcut
for <1 .. Inf>, ? * is a shortcut for <0 .. 1>.

* The ? of non-greediness can come before the closing > - <1 .. 3 ?>

Your argument seems to be "<1..3> is cleaner-looking to me, and it is
possible to implement".  While that second constraint is always an
important one, cleanliness is not the highest concern.  There's more
to beauty than what the eye can see.

I believe that **{1..3} was at one point spelled <1,3>.  The rather
glaring inconsistency of that is that <>-constructions are always
assertions, never modifiers.   That is to say, in the rest of the
regex design, whenever you see <blah>, it never depends on what comes
before it.

Another important loss if we were to go with <1..3> would be the
ability to have runtime-dependent ranges; e.g.:

   / ($ntimes) x**{$ntimes} /

You also lose the ** exponentiation mnemonic, which I found pretty on
the inside :-).  You also lose the *-like (because it really is just a
special kind of *) mnemonic.  I think the losses are too great to
warrant such a change just for the purpose of visual appeal.


Reply via email to