lua-users home
lua-l archive

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


I've thought on occasion that it would be useful to have a syntax for
specifying that a particular function or table should actually be created
once at chunk scope rather than each time the normal control flow would
instantiate it.

Of course, this would then need to come either with additional logic
regarding upvalues -- i.e., they aren't allowed in such a context -- or we
need to make sure that the change in scope doesn't change the binding for
any upvalues.

All in all, while it's attractive for optimizing a variety of standard
constructs, it seems like it overly complicates the language and we might be
better served looking for implementation optimizations for non-escaping
functions and tables.

Mark