[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Clean Lua
- From: "William C. Bubel" <wcbubel@...>
- Date: Fri, 18 Nov 2011 21:01:27 -0500
On 11/18/2011 08:45 PM, Ignacio Burgueño wrote:
> On Fri, Nov 18, 2011 at 10:43 PM, William C. Bubel <firstname.lastname@example.org
> <mailto:email@example.com>> wrote:
> On 11/18/2011 11:41 AM, GrayFace wrote:
> > What I don't like about 5.2 is that 5.1 is cleaner in many ways.
> > ...
> > function definitions always produce a new function
> Can somebody clarify this for me? What's the situation in 5.2 where the
> function keyword wouldn't produce a function object?
> function foo()
> local function bar()
> In Lua 5.1, a call to function "foo" will create a new instance of
> function "bar" each time. Lua 5.2 will create only one instance if "bar"
> has the same upvalues each time.
This seems like a reasonable optimization. Is there a hidden gotcha that
GrayFace is concerned with that I'm not seeing? I suppose if you were
doing equality checks between functions to determine object identity,
you would get tripped up, but I was under the impression that tables
were the golden standard for objects.