lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Well I guess we shall have to disagree .. my understanding is that the original concern was to use the fields of a table to synthesize, at compile time, a set of local variables, thus contracting the common "local foo = …" idiom.

This can be made to work pretty easily:

local … from { a = 10, b = 20 } -- here "..." means to create names from the table fields.

This is far harder:

t1 = { a = 10, b = 20 }
-- lots of other code here
local … from t1

The 2nd example needs static analysis, something that is expensive to do, and in any case depending upon the "lots of other code" may be indeterminate. That was my point.


On May 18, 2013, at 7:29 PM, Andres Perera <> wrote:

You are conflating concerns. Strictly speaking, the original problem
was to determine the space needed for local slots, therefore the only
relevant datum is the number of elements. The problem with field names
is orthogonal to that.