[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: A stupid question
- From: "Javier Guerra" <javier@...>
- Date: Mon, 31 Mar 2008 12:11:26 -0500
On Mon, Mar 31, 2008 at 10:52 AM, ketmar <firstname.lastname@example.org> wrote:
> > Do both functions share 'a' as an upvalue?
> > If so, how can they hold a reference to a simple
> > value (as opposed, for example, as to a table)?
> compiler magic, upvalue is a special reference that is invisible to
> user (but you can examine it with debug library).
i think 'upvalue' is a misleading term. it's just a local variable,
local to the do...end block and not to either of the functions. (of
course that block exists inside the chunk's function).
AFAIUI, the execution of the do...end block creates the storage for
the variables (how would that be called? i guess it's not a 'stack
frame'), and the functions (closures, in fact) reference that local