[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Reuse of Function
- From: Roberto Ierusalimschy <roberto@...>
- Date: Fri, 31 May 2013 09:08:58 -0300
> What I think, but unsure about, is here "function" actually means
Yes; see the original description:
Closures with the same reference are always equal. Closures with any
detectable difference (different behavior, different definition) are
(Yes, we know that "same reference" is not very clear...)
> I'm not sure what "observable difference" means.
It means that the result of some expression can change if you replace
one function by the other.
> 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.
Two function definitions f1 and f2 appearing in different lines of
source code have an observable difference: debug.getinfo(f1).linedefined
is diferent from debug.getinfo(f2).linedefined. So, Lua must consider f1
different from f2.