in reply to Re^8: Unclear about 'our'
in thread Unclear about 'our'
an explicit block is just cosmetics, since the file-scope acts as a default block.
I'd be surprised if the definition of a closure really is that broad, but I don't have the time to research in detail right now. Update: To clarify: I did skim the Wikipedia article before posting and it makes it pretty clear to me that definitions differ, so I suspect that simply our definitions differ. In the context of Perl, perlglossary does say that a closure is "An anonymous subroutine that, when a reference to it is generated at runtime, keeps track of the identities of externally visible lexical variables, even after those lexical variables have supposedly gone out of scope."
Update 2: Ok, so I did do at least a little bit more research. The above definition of a closure is repeated across much of the Perl documentation, but then there's Persistent variables with closures that shows a named sub that is closer to what you showed. So like I said, I guess definitions differ.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^10: Unclear about 'our' (updated)
by LanX (Saint) on Dec 29, 2022 at 12:15 UTC |