[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: state of the Lua nation on resource cleanup
- From: Mark Hamburg <mark@...>
- Date: Sun, 15 Feb 2009 22:04:23 -0800
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.
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.)