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. :-)