Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^3: closures: anonymous subs vs function templates?

by Laurent_R (Canon)
on Dec 21, 2014 at 18:22 UTC ( [id://1110977]=note: print w/replies, xml ) Need Help??


in reply to Re^2: closures: anonymous subs vs function templates?
in thread closures: anonymous subs vs function templates?

The lexical form is certainly more limited.
I don't really agree with that sentence. Being able to limit the scope is usually extremely useful. It not only reduces the risk of errors associated with global variables (and other global identifiers), but it also makes it possible to build very powerful constructs.

Perl 5.0 introduced lexical variables, Perl 5.6 introduced lexical file and directory handles, Perl 5.18 introduced lexical subroutines, the tendency over the years has been to go more and more for lexical "things". Because they add a lot of expressive power to the language.

  • Comment on Re^3: closures: anonymous subs vs function templates?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2024-04-24 18:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found