[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Deprecating setfenv()
- From: Miles Bader <miles@...>
- Date: Sat, 09 Jan 2010 23:11:53 +0900
Bertrand Mansion <lua@mamasam.net> writes:
>> Yes, it would be useful to know _why_ these changes are being made...
>
> Personally, I never liked setfenv/getfenv, so I think what Lua authors
> have done is really an improvement.
So... did you ever _use_ them? I gather all the complaints are coming
from people who do...
> I am glad these two functions will be moved to debug, that's where
> they belong. I wouldn't call this "deprecated", in my opinion it is
> just a clear sign that these functions are lower-level and that there
> are now more user-friendly ways to achieve similar things.
No. That's not what the debug package signifies.
A constant refrain in the Lua community is that you should _never_
depend on "debug" package functions, and should only use them for
debugging.
> Besides, the new syntax is a lot more readable in my opinion and leads
> to code that is easier to maintain.
setfenv/getfenv are _not_ user-level functions; they're functions used
by people writing frameworks for users to use. So you're right, they're
low-level, but they're _useful_ for people that are writing low-level
code.
I _don't_ dislike the new "in ENV" syntax -- I think you're right that
it looks like a much nicer thing for users to use directly. But it is
not a replacement for setfenv/getfenv, which have other uses, largely
for writers of frameworks etc.
-Miles
--
Bore, n. A person who talks when you wish him to listen.