[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Why are these functions not equal?
- From: Coda Highland <chighland@...>
- Date: Sat, 29 Mar 2014 00:35:26 -0700
On Sat, Mar 29, 2014 at 12:17 AM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
> The Lua 5.2 manual says:
>
>> 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.
>
> This remark says "may". It is surprising that in the simplest possible case,
> it does not happen.
>
> ~~~~
> $ lua
> Lua 5.2.3 Copyright (C) 1994-2013 Lua.org, PUC-Rio
>> x=function() end; y=function() end
>> print(x==y)
> false
>> print(string.dump(x)==string.dump(y))
> true
> ~~~~
>
Is this a quiz question or a legit one? Because I know the answer.
/s/ Adam