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

[perl #120047] perl should enable "$_" for use before calling subs

Thread Previous | Thread Next
From:
Linda Walsh via RT
Date:
September 29, 2013 19:45
Subject:
[perl #120047] perl should enable "$_" for use before calling subs
Message ID:
rt-3.6.HEAD-31239-1380483889-436.120047-15-0@perl.org
On Sun Sep 29 04:43:25 2013, LeonT wrote:
> On Sun Sep 29 02:26:28 2013, LAWalsh wrote:

> > Regardless of documentation that may justify this behavior, I would
> >    like to
> > see the design reasons for this behavior if such is to be found.
> > I see no logic in disabling $_, **randomly*** (based on callstack) in
> > a sub-function or library call but allowing it for built-ins. 
----
> When using $_ in a subroutine and you do not want it to affect or or be
> affected by the calling environment, you should use local on it. Or
> better yet, just use a lexical variable. Not doing so is a bug, your
> bug. Perl is behaving as intended and expected.
----

> Closing this as not-a-bug
-====
As I said, referring to current behavior or saying that the current
buggy behavior is "by design", doesn't mean it isn't a bug.  That you
didn't understand that basic premise is typical of one who engages in
unthinking behavior in order to close bugs (not that you always do, but
*often* do).

If you can show what would be harmed by my change, I'll accept it as not
being a bug.  Otherwise, I assert you've placed a needless restriction
on library code -- that all of them must use "local" $_ --
which may be completely inappropriate, especially given that the
locality of $_ isn't preserved across lateral transfers of control made
with "goto".  






---
via perlbug:  queue: perl5 status: rejected
https://rt.perl.org:443/rt3/Ticket/Display.html?id=120047

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