develooper Front page | perl.perl5.porters | Postings from June 2016

Re: [perl #128213] No deprecation warning on literal left curlybracket in /.{/ etc

Thread Previous | Thread Next
Karl Williamson
June 10, 2016 03:59
Re: [perl #128213] No deprecation warning on literal left curlybracket in /.{/ etc
Message ID:
On 05/25/2016 12:00 PM, Tom Wyant via RT wrote:
>> I think that 5.26 should go out with the current fatal error for the
>> contexts where we previously warned, and 5.28 is free to re-purpose
>> the
>> '{' uses in these contexts.
>> And, I want to make the rule simple to follow.  I think it's better to
>> simply say that unescaped literal '{' uses are deprecated, and then
>> add
>> a caveat that this is enforced only where there is ambiguity of
>> intent.
>>   The current text can be improved in that regard.
> The thing is, the more I think about it, the more I think the simple-to-follow argument says un-escaped literal '{' should not become fatal until _all_ cases of interest can be made fatal. Doing it in two (currently) stages means, at least, explaining to people that they are allowed (with a warning) to write /^{/, but /\A{/ is fatal -- and the same for however many other cases there are.
> Or have I misunderstood?

I don't think you've misunderstood.  But I am loathe to back off the 
fatal errors, given that we've now likely got the module authors' 
attention after 5 releases of threatening them with this, with quite a 
few ignoring or not noticing.

It would actually be best to make the new warning fatal for regexes 
compiled within those modules, so that the authors would only have to 
get involved once on the entire issue.

I'm attaching a patch to look at which changes the current error's text 
to indicate that it is fatal in this particular context.

It adds a new warning in the contexts where it should have warned but 
didn't, and indicates that in those particular contexts, it's still 
legal, but you shouldn't do it.

And I added explanatory text to perldiag explaining the situation 
enough, I think, to quell any confusion.  It indicates the contexts 
where no warning is given, and which we'll probably never deprecate, one 
of which is /^{/.  This is used enough in cpan, it turns out, to want to 
not deprecate it, and it makes no sense to have the { be anything else 
here but a literal brace.

> ---
> via perlbug:  queue: perl5 status: open

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