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

RE: RE: RE (tilly) 3: Fly Subroutines on the Fly

by merlyn (Sage)
on Sep 19, 2000 at 22:32 UTC ( #33174=note: print w/replies, xml ) Need Help??

in reply to RE: RE (tilly) 3: Fly Subroutines on the Fly
in thread Fly Subroutines on the Fly

You seem to be talking about run-time compilation of new subroutines. While that can be a powerful technique, it is different than closures (to me, at least).
Yes... casually, people say "closures" when they mean "anonymous subroutines". But properly speaking, a subroutine (anonymous or not) is not a closure unless it also captures lexical state that can go out of scope. See Closures (was Re: for loops) for an example of detection.

-- Randal L. Schwartz, Perl hacker

  • Comment on RE: RE: RE (tilly) 3: Fly Subroutines on the Fly

Replies are listed 'Best First'.
RE (tilly) 6: Fly Subroutines on the Fly
by tilly (Archbishop) on Sep 19, 2000 at 23:05 UTC
    Yes. I tend to be pretty casual.

    In point of fact constructors for interesting anonymous functions almost inevitably are closures. For instance the example I mentioned of something which I would have written this way had I been writing it (Pod::Parser) is one where the optional hooks would be anonymous subs that were in lexical scope. Therefore the final thing constructed is a closure by anyone's use of the language. :-)

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (2)
As of 2023-10-04 16:41 GMT
Find Nodes?
    Voting Booth?

    No recent polls found