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

Re^4: Eliminating "used only once" warnings from List::Util::reduce

by davido (Archbishop)
on Jul 30, 2013 at 19:28 UTC ( #1047109=note: print w/ replies, xml ) Need Help??


in reply to Re^3: Eliminating "used only once" warnings from List::Util::reduce
in thread Eliminating "used only once" warnings from List::Util::reduce

Yes, that's the problem with simple fixes. I actually thought of something similar to the BEGIN{ $main::a... trick and submitted it months ago for List::MoreUtils::pairwise, where it was eventually pointed out (as I should have realized myself) that it would only work for the first invocant of use Modulename.

On the other hand, import does have caller context. So a fix could be applied within import. But as I mentioned in another post in this thread, that wouldn't solve times where the user skips import with "use List::Util ();, and then fully-qualifies List::Util::reduce in his code.

So, this can be mostly fixed by overriding import. But probably instead should be fixed within the Perl interpreter so as to special-case $a and $b further. They already have special case treatment for strict vars. One step further isn't going to suddenly allow a bunch of "only once" bugs to slip through people's code.


Dave


Comment on Re^4: Eliminating "used only once" warnings from List::Util::reduce
Select or Download Code
Re^5: Eliminating "used only once" warnings from List::Util::reduce
by BrowserUk (Pope) on Jul 30, 2013 at 19:33 UTC
    But probably instead should be fixed within the Perl interpreter so as to special-case $a and $b further.

    I always thought that it would be (would have been) better to use $A & $B for this instead.

    That might at least prevent all these pointless "Don't use $a & $b" pseudo-commandments.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (15)
As of 2014-04-16 17:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (433 votes), past polls