Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: cross scope gotos?

by BrowserUk (Pope)
on Apr 06, 2010 at 11:53 UTC ( #833026=note: print w/ replies, xml ) Need Help??


in reply to cross scope gotos?

So what exactly is a "dynamic scope" here?

Basically anywhere in the current program that hasn't been optimised away:

perl -e"sub x{ goto $_[0] } bill: x( 'bill' ) " perl -e"sub x{ goto $_[0] } bill: x( 'john' ); john: goto bill;"

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.


Comment on Re: cross scope gotos?
Download Code
Re^2: cross scope gotos?
by LanX (Abbot) on Apr 06, 2010 at 15:19 UTC
    > Basically anywhere in the current program that hasn't been optimised away:

    not that easy!

    perl -e' goto INTO; print "Start"; for $i (0..9) { INTO: print "STOP"; };' Can't "goto" into the middle of a foreach loop at -e line 4.

    You can't jump to a label out of the current or previous frames!

    see Re^3: cross scope gotos? and goto

    Cheers Rolf

      You can't jump to a label out of the current or previous frames!

      I think that's (currently) an over statement:

      perl -le"goto loop; $x=0; if( $x ){ while(1){ loop: print 'hi' } }"

      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.
        > I think that's (currently) an over statement:

        nope, while has a proper block but not a proper "frame" like foreach or subs.

        (I read somewhere that foreach has internally a frame, but no time to search now...)

        But the confusion is understandable, that's why I started the thread.

        Cheers Rolf

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2014-04-21 04:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (490 votes), past polls