lua-users home
lua-l archive

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


* David Manura:

> True, but I was wondering why we can't just express a module in
> arguably the most natural way like this:
>
>   -- bar.lua
>   local x = 1
>   function foo() baz() end
>   function baz() print(x) end

> So, why can't Lua make that same inference?

The main problem here is the bare baz() call.  It's difficult to
preserve its semantics while running without metatables after the
initial load.  It seems as if we want something that has the semantics
of local variables in Python, which is rather surprising because I
tend to regard them as extremely odd.

Anyway, isn't this a continuation of the "referencing table elements
within the same table constructor" thread?