develooper Front page | perl.perl5.porters | Postings from October 2015

Re: [perl #126185] /(?-p)/ should be an error

Thread Previous | Thread Next
October 7, 2015 21:13
Re: [perl #126185] /(?-p)/ should be an error
Message ID:
On Wed, Oct 07, 2015 at 10:02:22PM +0200, Victor ADAM wrote:
> > I think that the consequences are mild, so it was the right design decision to be a warning.
> In that case we should fix all the equivalent but inconsistent errors:
> /(?-a)/ dies with “Regexp modifier "a" may not appear after the "-" in
> regex; marked by <-- HERE in m/(?-a <-- HERE )/ at -e line 1.”
> Unless I’m missing something, the two are essentially the same, and
> should thus have the same behavior. Having /(?-a)/ die but /(?-p)/
> warn doesn’t sound like a “right design decision” to me.

Yeah, but we have to be practical. /a is fairly new, and /(?-a)/ has
died since /a was introduced. /(?-p)/ has been allowed for some time.
We don't know whether there's code out there which has it. Or how much. [1]
Considering that it's pretty harmless, I don't think dying is appropriate.
Perhaps we should not even add a warning now. Now, if /p was new, I
would not object to it dying.

What's the gain if /(?-p)/ started dying?

[1]  If there's a lot of code out there which uses /(?-p)/, then making
     it die (or even warn) now hurts a lot of people. If there isn't a
     lot of code out there which uses it, then it hardly matters what
     is done (die, warn, nothing).


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