lua-users home
lua-l archive

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


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.