lua-users home
lua-l archive

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

On 27 Nov 2010, at 20:37, David Kastrup <> wrote:
> The Lua approach would be to _make_ functions tables.  Then one need not
> worry about one being supported differently from the other.

I think Lua is more pragmatic than that. There are important differences in efficiency between functions and tables: arguments and local variables are more efficient than table entries. This is not just an artefact of the implementation: LuaJIT's analyses rely on the restrictions on how you can use local variables (without going through the debug library) such as not being able to enumerate them like a table and not being able to get or set them via a dynamically computed name.

If you want a language that uses the same structures for tables and functions, see Python.

f.anthony.n.finch  <>