lua-users home
lua-l archive

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

If Lua is going to shy away from introducing an explicit finalization mechanism, how about introducing better mechanisms for manipulating function environments (which would better support John's scope system in Lua Gems)?


1. There needs to be a way to replace the environment on a function and get a new function. This would be useful in a variety of contexts. But examples like John's which save and restore the environment seem fraught with danger. (I've also wanted this capability when designing object systems and thinking about how to define "super").

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, ... )

This does not change the actual environment on fn. It merely changes the environment used in the call. If nesting is true, then we want to construct an environment that uses the supplied environment and then chains to the actual environment. (Definition of chaining TBD.)