but, why have even the slightest doubt? why not {?foo|bar}, or even {foo|bar}
and save parens for just one purpose. Surely the following is clearer:
"fred barney betty wilma" =~ /(fred) {barney|dino} (betty) (wilma)/;
How would it handle this:
"fred5 wilma2 barney11 betty12" =~ /(fred)5 (wilma){2|10} (barney)11 {betty|alex}{5|12}/;
Steve
--
University of Florida, Department of Computer and Information Sciences
email: spp@{cis.}ufl.edu smail: Stephen P Potter, E309A CSE, UF Campus
Click here for the <a href="http://www.cis.ufl.edu/perl">Perl WWW Page</a>
I BOYCOTT ANY COMPANY THAT USES MASS INTERNET ADVERTISING
Every now and then, paranoia is a survival characteristic.
: why not {?foo|bar}, or even {foo|bar}
: and save parens for just one purpose. Surely the following is clearer:
:
: "fred barney betty wilma" =~ /(fred) {barney|dino} (betty) (wilma)/;
Unfortunately, unbackslashed curlies are currently be interpreted
literally if they don't contain a sequence of digits (and maybe a
comma). Doubtless many people have written regular expressions to take
advantage of this. Suddenly forcing them to be metacharacters will
break things. Not to mention the fact that there's ambiguity. Is
{12345}{12345} a sequence of 12345 12345's? Does {?foo}* mean 0 or
more foos, or does it match an optional left curlie followed by foo
followed by 0 or more right curlies? It currently has the latter
meaning.
On top of which, curlies already have 5 or 6 overloaded meanings in
Perl 5. I hesitate to add yet another one. Just in terms of visual
distinction, I think <> would stand out a lot more, unless you're
matching HTML or something.
The reason we're talking about (?foo) is that it's currently illegal
to quantify a left parenthesis, so it wouldn't break anything to give
this syntax a meaning. The same cannot be said of curlies, or angle
brackets for that matter.
Anyway, there's plenty of room for doubt. It might seem easy enough,
but computer language design is just like a stroll in the park.
Jurassic Park, that is.
Larry
Michael> but, why have even the slightest doubt? why not {?foo|bar}, or even {foo|bar}
Michael> and save parens for just one purpose. Surely the following is clearer:
Michael> "fred barney betty wilma" =~ /(fred) {barney|dino} (betty) (wilma)/;
That's not upward compatible with:
"fred barney" =~ /(fred){1} (barney)/;
Note the difference between that and:
"fred1 barney" =~ /(fred)(?1) (barney)/; # illegal, proposed syntax
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
# legal fund: $945 collected, $9835 spent; email @FUND in body for details
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <mer...@ora.com> Snail/FAX: (Call) aka: <mer...@teleport.com>
Phrase: "Welcome to Portland, Oregon ... home of the California Raisins!"