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

[perl #118511] Use of bare << to mean <<"" is deprecated - make a hard error

Thread Next
Ricardo SIGNES via RT
July 1, 2013 03:31
[perl #118511] Use of bare << to mean <<"" is deprecated - make a hard error
Message ID:
This is another of those situations that, I think, isn't really as straightforward as it might seem.  
Here are some facts and observations, carelessly mingled:

* use of bare << to mean "" has been deprecated since 5.002 (1996-02)
* starting then, it warned under "use warnings"
* starting it 5.12.0, it warned even without warnings requested (2010-04)
* when we deprecate things, we do it because we have a reason to actually remove it
* if we just think it's a bad idea, we "discourage" it instead
* use of bare << to mean "" has been *deprecated* since 5.002 (1996-02)
* ... but this discourage/deprecate distinction is a recent innovation
* records of the discussion of this deprecation, if any, are not easy to find
* ...but we know that we're not talking about dropping this behavior to make room for another
* rjbs has acknowledged thinking that this is a nasty piece of syntax, which will lead to 
* somewhere, out there, there is code that will be busted if this code is removed

So, if we remove this behavior, something breaks, but the language is otherwise somehow 
better.  What's the actual tradeoff?

Code that will break was either written before 1996, written without consulting the 
documentation, or written despite the documentation's warnings.  It doesn't "use warnings" or 
nobody is looking at its warning output.  It isn't running on perl v5.12.0 or later, or "no 
warnings" is there to shut up the warnings.  So, the code that will break will be code that 
expressly turned off warnings, or is being run ignoring the warnings, or is being upgraded from 
5.10.x (or earlier) to 5.20.x directly, meaning a minimum of five years between releases used.
The solution in all cases is to replace << with <<""

The benefit to weigh against these costs are: (1) the removal of a very small amount of code; (2) 
the removal of a very small amount of documentation; (3) the proof that when we say 
"deprecated," we mean it really will go away; (4) the resolution of a pending deprecation, which 
otherwise will float in the air.

I find (3) to be the least compelling on its own.  It's okay to be wrong about having deprecated 
something.  We can take as long as we like.  It's more compelling in conjunction with (4).  How 
often are we going to have this conversation about bare <<?  We just had it two years ago:

Sometimes, it's good to take a nice long time to figure out the right answer.  Sometimes, that 
answer needs to come so that there is no more lingering question.  It's an issue of keeping the 
number of open questions low.

I see no value in keeping "bare <<" heredocs around, other than avoiding the breakage of a 
presumably small amount of code that, frankly, has had every opportunity to reform.  There is 
no future in which I see the feature being appreciated and spared from the looming threat of 
removal.  We should put it out of its misery and move on, freeing up discussion time for things 
of greater value.


via perlbug:  queue: perl5 status: open

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