develooper Front page | perl.perl5.porters | Postings from August 2010

Re: Any opposition still to the idea of syntax indicating default regex modifiers?

Thread Previous | Thread Next
From:
Ronald J Kimball
Date:
August 13, 2010 10:32
Subject:
Re: Any opposition still to the idea of syntax indicating default regex modifiers?
Message ID:
20100813173243.GB54726@penkwe.pair.com
On Fri, Aug 13, 2010 at 05:26:56AM +0100, Ben Morrow wrote:
> Quoth public@khwilliamson.com (karl williamson):
> > Ben Morrow wrote:
> > > At 11AM -0600 on 11/08/10 you (karl williamson) wrote:
> > >> Ben Morrow wrote:
> > >>> FWIW I'm not convinced allowing (?.-i:
> > >> Please explain your concerns.
> > > 
> > > It's always redundant, so any situation where it appears is
> > > unnecessarily confusing. (You do realise I'm not talking about -i
> > > specifically, but about *any* negated flags?)
> > > 
> > > To go back to my chmod analogy, we have a+x and a-x and a=x, but not
> > > a=-x, because that would be silly.
> >
> > Do you want a warning or an error?
> 
> I want it to not be valid syntax, just as though I'd written
> 
>     /(?.x!i:foo)/
> 
> or anything else invalid. I suppose that means 'error', but just an
> ordinary 'Sequence not recognized in regex' error, not a special case.

I don't agree with the justification for disallowing (?.-i: .

Perhaps someone will want to emphasize that case insensitive matching is
turned off in a certain case.

Perhaps someone will write a regex generator that allows the user to
specify which options are on and which are off.  Disallowing (?.-i: means
the program would have to keep track of which options were off by default.

The program would also have to be updated each time a new option was added
to the language.

I don't think there's anything gained by disallowing the syntax, but there
are things gained by allowing it.

Ronald

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About