lua-users home
lua-l archive

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


On Tue, 19 Jan 2010 17:25:36 +0200, Mark Hamburg <mark@grubmah.com> wrote:

This approach is quite different from what Lua does now but at the same time is fully compatible with most code (under the assumption that setfenv is rare and getting rarer and hence most code was operating in a single shared environment anyway).

I might be mixing something up, but is it really compatible with current
code? Like module definitions:

module "A"
function dothis() end --define A.dothis
function dothat() dothis() end --define A.dothat, FAIL when called

It has pros and cons depending on what you want to do. One increasingly big pro for me when I look at it is that it is actually moderately easy to describe. It's also much more friendly toward threaded (coroutine) code than uses of setfenv at any time other than immediately after code has been loaded.

It is a completely new mechanism. If you replace current environment handling
with this, you get a very different language, semantically.
Better - maybe, but different (userdata environments, modules, ...)
If you add it as additional possible name binding, then I think there
would be a total confusion, unleast you declare variables explicitly:

local a; dynamic b; global c;