Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^8: How A Technique Becomes Over-rated

by Anonymous Monk
on Sep 23, 2005 at 18:14 UTC ( #494619=note: print w/ replies, xml ) Need Help??


in reply to Re^7: How A Technique Becomes Over-rated
in thread How A Function Becomes Higher Order

But, by limiting your customization technique to callbacks, all shared state must be stored in the lexical scope of the caller.
($foo, $bar) = incrementByOneAndTwo(42); ($baz, $quux) = incrementByOneAndTwo(0); $\="\n"; print $foo->(); print $bar->(); print $quux->(); print $foo->(); print $baz->(); print $bar->(); print $quux->(); sub incrementByOneAndTwo { my $shared_state = shift; return (sub{$shared_state+=1}, sub{$shared_state+=2}); }


Comment on Re^8: How A Technique Becomes Over-rated
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (12)
As of 2015-07-03 08:21 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 (49 votes), past polls