[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [NoW] Deja vu
- From: Dennis Fischer <darkwiiplayer@...>
- Date: Fri, 9 Aug 2019 17:15:27 +0000
This actually seems pretty intuitive to me; in fact, I don't see why the
two functions *would* be the same.
If you know that it's always the same function, you can move it out of
the loop yourself.
That's one less thing the compiler will have to think about, meaning
simpler code.
To me it's the behavior of versions 5.2 and 5.3 that seems like a bug.
On 08/08/2019 01:28, Egor Skriptunoff wrote:
> t = {}
> for j = 1, 2 do
> t[j] = function(x) return 2*x end
> end
> print(t[1] == t[2])
>
> Lua 5.1 false
> Lua 5.2 true
> Lua 5.3 true
> Lua 5.4 false
>
> It seems that the equality between function values has returned back
> to its Lua 5.1 semantics.
>
> 1)
> Why "function values caching" has been removed from Lua 5.4?
>
> 2)
> Could we rely on the fact that in Lua 5.4+ any created function is
> unique value?