lua-users home
lua-l archive

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


Let me bore everyone with another crack at this automatic variable thing:

Suppose the local keyword was generalised to a local shortcut generator so:

local foo, bar, lua : a_table_ref

Means that within the current lexical scope, "foo" means "a_table_ref[foo]", etc.

local foo, bar, lua

Is syntactic sugar for "local foo : getenv()" (Simulating the current behaviour).

local foo, bar, lua : _G

Gives the desired global declaration without having to introduce "global" as a keyword. There'd still need to be an OPTION EXPLICIT switch to require (or not for compatibility) global declarations.

This gives the additional innovation of allowing local shortcuts to ANY table, for example:

local function1, function2 : MyVerboseCodeLibrary.AnotherLevelofGratutiousAbstraction.HaveIMadeMyPointYet

Just another crazy idea for the critics to shoot full of holes ....