lua-users home
lua-l archive

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

I read the following in Lua 5.2 References:

"Equality between function values has changed. Now, a function
definition may not create a new value; it may reuse some previous
value if there is no observable difference to the new function."

What I think, but unsure about, is here "function" actually means
"closure". The most plausible, to me, of reusing a "function
definition" (actually a closure, if I understand correctly) is a
enclosing function (or loop, or other blocks) of a closure is invoked
more than once. In terms of code, I guess it means Closure is reused
rather than Proto.

I'm not sure what "observable difference" means. I don't think it
means two function definitions appearing in different places of source
code with almost or exactly the same code string will generate one
single shared Proto struct.

Is my understanding correct?