lua-users home
lua-l archive

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


On Feb 16, 2009, at 5:16 AM, Roberto Ierusalimschy wrote:

Vaguely:

1. There needs to be a way to replace the environment on a function and
get a new function. ..

2. It would be nice to have a way to call a function with a particular environment even if that function has a protected environment. Something
like:

	call_with_environment( environment, nesting, fn, ... )

If you have (1) than you get (2), no? (Create the clone and call it.)

Yes, (1) gets you (2) though it comes at a price in memory allocation.

But (1) seems dangerous in some scenarios.

I don't see that it's any more dangerous than setfenv. It just avoids stomping other uses of the function.

Mark