lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Tue, Oct 23, 2012 at 2:15 PM, Javier Guerra Giraldez
<javier@guerrag.com> wrote:
> On Tue, Oct 23, 2012 at 2:46 PM, spir <denis.spir@gmail.com> wrote:
>> Yes, thank you very much. I knew of such uses of closures, actually, but had
>> not yet realised they require the variable, not the data, to be recorded
>> with the func.
>
> personally, i wouldn't call a function 'closure' if it doesn't enclose
> external variables like that.  in fact, i don't consider a language
> has lexical scoping unless it implements real closures.

Then you would be wrong. :P You can still consider it a closure if it
COPIES the scope instead of REFERENCES it. The ability to modify the
state of a closure after it's created isn't a requirement to the
definition of a closure.

/s/ Adam