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
Ronald J Kimball
August 13, 2010 10:32
Re: Any opposition still to the idea of syntax indicating default regex modifiers?
Message ID:
On Fri, Aug 13, 2010 at 05:26:56AM +0100, Ben Morrow wrote:
> Quoth (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.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About