[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: stack level parameter
- From: Doug Currie <doug.currie@...>
- Date: Tue, 19 Jan 2010 11:43:23 -0500
On Jan 19, 2010, at 10:25 AM, Mark Hamburg wrote:
> [...] The rules are essentially:
>
> * Lookup is done in the environment for the current call frame
> * The environment in a new call frame is initialized to be equal to the environment in the preceding (calling) call frame
> * in-do-end temporarily changes the environment in the current call frame
Nice.
> [...]
> One could build such a stack via appropriately constructed environments:
>
> in _G:pushenv( env ) do ... end
>
> Or just:
>
> in pushenv( env ) do ... end
Yes, pushenv would be essential; getenv less so.
I agree that the dynamic environment should be tied to the stack frame. Entering and leaving threads would benefit from an automatic dynamic context switch. Leaving a function activation that established special dynamic bindings automatically restores the bindings.
e