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

Re: [perl #128241] Deprecate /$empty_string/

Thread Previous | Thread Next
From:
Dave Mitchell
Date:
July 11, 2016 14:13
Subject:
Re: [perl #128241] Deprecate /$empty_string/
Message ID:
20160711141254.GB3477@iabyn.com
On Fri, May 27, 2016 at 02:03:05PM +0200, Aristotle Pagaltzis wrote:
> * Smylers <Smylers@stripey.com> [2016-05-27 13:39]:
> > > Otherwise you can turn off this warning and carry on.”
> >
> > Except the bug hasn't been fixed yet
> 
> D’oh.
> 
> > so it'd make more sense to actually fix it now, but you could change
> > it back to what it currently is after the following upgrade.
> 
> Yeah, awkward.
> 
> > That seems like more hassle on users than a typical deprecation
> > warning. Or at least a different sort of hassle.
> >
> > Is that really worth it for the sake of genuine uses of /$empty/, who
> > we don't know even exist at all?
> 
> The reason for my discomfort is that this change in behaviour can easily
> lead to silent data corruption if the code was previously correct, and
> even in cases where the sudden difference in behaviour gets noticed, it
> may be very hard to track down what caused it. So I would not want that
> change made without giving sufficient notice that it’s coming.
> 
> But you are right that it’s less than obvious how to do this coherently.

Another possibility is to change the behaviour now, but also warn
whenever the changed behaviour is encountered. For these two scenarios:

1. The user's code is currently buggy (it expects /$empty/ to be like /(?:)/)

Formerly their code would quietly fail; in future their code will noisily
succeed. They can update their code to either: disable the warning; or if
they want their code to run on older perls, to fix it to be portable.

2. The user actually wanted the 'last regex' behaviour on /$empty/:

Formerly, their code worked;
in future their code fails, but with a noisy warning, alerting them that
their code needs fixing on newer perls.

And just to recap, IIUC, the current proposal for this ticket is to;

1) leave literal // with its 'last regex' behaviour for now.
2) change /$empty/ behaviour, with the exact details on deprecation and
warnings to be decided.



-- 
Counsellor Troi states something other than the blindingly obvious.
    -- Things That Never Happen in "Star Trek" #16

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