Re: questions about closure construction
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: questions about closure construction
- From: Roberto Ierusalimschy <roberto@...>
- Date: 2013年3月19日 10:11:17 -0300
> On Tue, Mar 19, 2013 at 11:18 AM, Ross Bencina
> <rossb-lists@audiomulch.com> wrote:
> > I wonder whether the language guarantees unique identities for separately
> > constructed closures:
>
> Hm, well experimentation shows that functions are still unique objects ;(
>
> $ lua52
> Lua 5.2.1 Copyright (C) 1994-2012 Lua.org, PUC-Rio
> > f = function() end
> > g = function() end
> > = f == g
> false
Lua 5.2.2 Copyright (C) 1994-2013 Lua.org, PUC-Rio
> a = {}; for i = 1, 2 do a[i] = function () end end
> = a[1] == a[2]
true
-- Roberto