[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: setfenv/getfenv
- From: Nicolas <nicolas@...>
- Date: 12 Jan 2010 18:32:22 +0100
> I will try to rationalize the complaints. Many people complaints about
> the removal of getfenv/setfenv because:
> 1) you lose the ability of sandboxing a script that you load
> 2) with userdata you are losing the opportunity of:
> - let the Lua GC be aware of cross dependencies between userdata objects
> - let a userdata store some Lua data.
>
> The answer to this kind of criticism is:
> 1) you can simulate the sefenv for sandboxing by using the "in" syntax
> to construct on the fly a new string that you pass to loadstring =>
> this is ugly and totally not-elegant and not efficient
> 2) the getfenv/setfenv will remain available in the C API => this is
> ambiguous because either they are first class ordinary functions
> either they are special debug functions.
>
> Because of these reason I believe that the Lua development team should
> come back through theirs steps and search another approach to solve
> the problem Roberto was talking about.
>
> This is my point of view, I hope it is helpful.
And you expressed my feelings much betetr than I did :)
Just to say it again: the concatenation of "in ... do" really feels
hackish and detriments an otherwise beautiful language. When I show
people lua and all its niceness they usualy go "wohh that looks so
clean and nice", I do not think they'll say that if I ever show
them something like that ;)