[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua registry, environment, and threads.
- From: Edgar Toernig <froese@...>
- Date: Fri, 8 Jan 2010 01:37:29 +0100
Roberto Ierusalimschy wrote:
>
> in t do command end
>
> is translated to
>
> do
> local _temp = t;
> <command>
> end
>
> and all acesses to <global> inside command are changed to _temp.global.
Hm... just my 2c: I was never comfortable with the whole fenv concept
(each function carries its own table of globals). IMHO it's too clever
and produces more confusion then it gives features. I saw not one use of
it that did not trigger my "dirty hack" radar.
I was glad to hear that setfenv&co should be removed in 5.2 and replaced by
a new "in" statement. Initially I thought, interesting, dynamic binding for
globals (like: push a new global table on a stack of globals, pop on "end"
and "error") but the more I read about the planned changes, the more I think,
the replacement is not better then the fenv stuff. It seems to really just
replace one use case of the setfenv function with syntax (and needs new
functions for the other use cases). As the setfenv function is probably
under the least used functions in the stdlibs, I see no reason which justifies
that it gets its own syntax. IMHO, even pcall would make more sense ...
ET, who only needs two kind of variables: locals and globals, not something
inbetween.
- References:
- Lua registry, environment, and threads., Christian Tellefsen
- Re: Lua registry, environment, and threads., Patrick Donnelly
- Re: Lua registry, environment, and threads., Roberto Ierusalimschy
- Re: Lua registry, environment, and threads., Christian Tellefsen
- Re: Lua registry, environment, and threads., Roberto Ierusalimschy
- Re: Lua registry, environment, and threads., Mark Hamburg
- Re: Lua registry, environment, and threads., Patrick Donnelly
- Re: Lua registry, environment, and threads., Roberto Ierusalimschy
- Re: Lua registry, environment, and threads., Enrico Colombini
- Re: Lua registry, environment, and threads., Roberto Ierusalimschy