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

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

Thread Previous | Thread Next
From:
Karl Williamson
Date:
October 7, 2015 21:36
Subject:
Re: [perl #126185] /(?-p)/ should be an error
Message ID:
56159059.5030603@khwilliamson.com
On 10/07/2015 03:13 PM, Abigail wrote:
> 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).
>
>
>
> Abigail
>

To be sure, there is some subjectivity to this whole thing, and 
reasonable people can come to different conclusions.

I agree with Abigail, but also, it's obvious what -p would mean, because 
p is a boolean flag.  But it's not obvious what -a would mean.  It is a 
character set modifier, and these are not booleans.  One of them is 
always in effect, /a /d /l /u or /aa.  To change the character set you 
say which one you now want; you can't just deselect one, because it's 
not obvious what you're selecting instead.  So, it's not clear what -a 
means at all, and therefore it should be an error.

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