lua-users home
lua-l archive

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


On Tue, Oct 23, 2012 at 4:19 PM, Coda Highland <chighland@gmail.com> wrote:
>> 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.

hum.... [citation needed]   :-)

reading wikipedia (yeah, not autoritative but the quickest reference i
found right now), the examples of 'not by reference' are:

ML: by value.  but these are immutable values, no semantic difference.
Java, C++11, PHP: these are not lexical scoping, so what they call
closure are just approximations
Haskell: binds to future results, just like variables, so it's similar
to binding to variables.

not to say i'm 100% right, after all it's just "...what i consider..."
but i don't see a counterexample.

-- 
Javier