Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Is auto-dereferencing worth forcing upgrades to newer versions of Perl?

by sundialsvc4 (Monsignor)
on Aug 15, 2013 at 13:40 UTC ( #1049589=note: print w/ replies, xml ) Need Help??


in reply to Is auto-dereferencing worth forcing upgrades to newer versions of Perl?

Definitely “not.”

There are millions of lines of Perl source-code in production service, and maintaining seamless compatibility across upgrades is very important.   Adding a fee-chur for no more reason than saving a programmer a couple of flexes of his fingertips on the keyboard .. when there already exists a way to get this done .. is an unwise thing to do, especially when the change is not “source-code obvious.”   Adding a new, convenient operator is okay because older Perl compilers will instantly reject it with a syntax error, with-or-without strict/warnings.   But adding a fee-chur which changes the meaning of existing source code is, in my opinion, a source of pointless grief.   I see no return-on-investment to warrant the greatly increased business risk.

Still want to do it?   Then introduce a use auto_dereference pragma, which only works on (say ...) 5.014 forward.   (The use 5.014; directive can stay, of course, but now it does not have “hidden meaning” that only a perlguts person would be expected to know.)   Now you are declaring, both to Perl and to the future programmers, what you mean.   Importantly, you are now doing it in a way that will generate syntax-errors in older Perls.   (You also presumably can now “bracket” specific sections of code with use/no blocks.)   The programmer gets a “heads up!!” alert to be on the lookout for “specifically, this New Thing,” and older compilers will fall on their face, flagging that particular line of source with its immediately-obvious import as their nose hits the pavement.


Comment on Re: Is auto-dereferencing worth forcing upgrades to newer versions of Perl?
Re^2: Is auto-dereferencing worth forcing upgrades to newer versions of Perl?
by tobyink (Abbot) on Aug 15, 2013 at 13:53 UTC

    I'm pretty sure that strict-or-not, you'll get a compile-time syntax error if you try this on Perls earlier than 5.14. You'd have quite a struggle to find existing Perl code that this change broke.

    I don't think it's a good feature, but it's a freeture, not a feeture.

    package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1049589]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (12)
As of 2014-07-10 13:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (211 votes), past polls