[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: a case for multiple environments - expressing modules more naturally
- From: Florian Weimer <fw@...>
- Date: Sun, 08 Aug 2010 20:57:31 +0200
* 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?