Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^4: cross scope gotos?

by Anonymous Monk
on Apr 06, 2010 at 13:20 UTC ( #833034=note: print w/ replies, xml ) Need Help??


in reply to Re^3: cross scope gotos?
in thread cross scope gotos?

No serious application whatsoever for this nonsense...


Comment on Re^4: cross scope gotos?
Replies are listed 'Best First'.
Re^5: cross scope gotos?
by LanX (Canon) on Apr 06, 2010 at 13:28 UTC
    > No serious application whatsoever for this nonsense...

    sigh, YOU again...

    you may use it for

    1. easily leaving deeply nested recursions, without the need to return step by step
      perl -e ' my $x; sub rec { goto STOP if ++$x>10; print $x; rec()};rec();STOP:' 12345678910
    2. easily defining specific labels and jump-commands in DSLs (Domain Specific Languages) and encapsulating all the logic within the subs.

      For instance if you want to emulate and/or compile an assembler language you can easily implement it as valid perl-code then easily using Perl as macro language:

      use Assembler::6502; # fictitious module # implementing Mnemonics as subs MARK: LDX 10; ADD 3; macro1(); # Perl sub to include/call mnemonics JSR SUB2; JMP MARK; SUB2: ... ... RET

    serious enough?

    Cheers Rolf

    UPDATE: added examples

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (14)
As of 2015-07-29 13:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (263 votes), past polls