lua-users home
lua-l archive

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

Mark Hamburg <> writes:
> So, I can sympathize with the decision to deprecate setfenv and
> getfenv (though I've got some trepidation about shifting to the debug
> module). I view loadin as a decided improvement. But I'm not convinced
> yet that in-do-end really makes things enough better to be worth the
> syntax.

For the cases where in-do-end or loadin doesn't really suffice, how
about some alternatives to setfenv, e.g. --

 callin (FUN, ENV)
     -- call FUN using ENV as its environment

 copyfun (FUN, ENV)
     -- return a copy of FUN, replacing its environment with ENV

I wish the lua devs would say a bit more about their motivations in
making this change, so people can focus on solving the problem in a way
that makes everybody happy; as it is, it seems like everybody's groping
in the dark...


Americans are broad-minded people.  They'll accept the fact that a person can
be an alcoholic, a dope fiend, a wife beater, and even a newspaperman, but if
a man doesn't drive, there is something wrong with him.  -- Art Buchwald