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

[perl #43077] goto & behaviour doesn't match documentation

Thread Next
From:
Father Chrysostomos via RT
Date:
September 25, 2012 20:19
Subject:
[perl #43077] goto & behaviour doesn't match documentation
Message ID:
rt-3.6.HEAD-11172-1348629578-1476.43077-15-0@perl.org
On Sun Jun 03 20:13:32 2007, jjore wrote:
> On 5/30/07, via RT Bo Lindbergh <perlbug-followup@perl.org> wrote:
> > # New Ticket Created by  Bo Lindbergh
> > # Please include the string:  [perl #43077]
> > # in the subject line of all future correspondence about this issue.
> > # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=43077 >
> >
> >
> > This is a bug report for perl from blgl@hagernas.com,
> > generated with the help of perlbug 1.35 running under perl v5.8.8.
> >
> >
> > -----------------------------------------------------------------
> > [Please enter your report here]
> >
> > The documentation for goto & says:
> >  > Instead, it exits the current subroutine (losing any changes
> >  > set by local()) and immediately calls in its place the named
> >  > subroutine using the current value of @_.
> >
> > Actually, it reuses the current argument array, which isn't
> > necessarily the same as @_.  The example program below shows
> > the difference.
> >
> > Either goto & should be modified to use @_ or the documentation
> > should be modified to match reality.
> 
> Better than patching that bit of documentation would be to perhaps
> note wherever it is that glob stomping is documented that doing this
> to magic variables might remove or mask their magic.
> 
> All the various bits of punctuation variable magic also work the same
> way. If you clobber the glob (even just temporarilly) you shouldn't
> expect it to still be magic.

The better solution might be to make goto &foo leave *_ alone, the way
&foo does.  I believe it would be faster, too.  And that would also
allow goto &foo to work inside an eval.

-- 

Father Chrysostomos


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

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