lua-users home
lua-l archive

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


-------- Original Message --------
Subject: Re: Lua 5.2 and in-do-end
From: Edgar Toernig <froese@gmx.de>
Date: Mon, January 25, 2010 11:44 am
To: Lua list <lua@bazar2.conectiva.com.br>

> Mark Hamburg wrote:
> >
> > in pushenv( t ) do
> 
> IMHO, pushenv should be the default behaviour of in-do-end.
> In other words, in-do-end should nest. I think, that would
> be the most common use and when handled by the VM, it won't
> cost a memory allocation for each in-do-end.
> 
> Of course, there has to be a method to tell in-do-env that
> searching should not go further up, i.e. a function 'sandbox'
> that inhibits further search:

> a=1
> in sandbox { pr = print, b=2 } do
>  pr(a,b,c) --> nil 2 nil
>  in { c=3 } do
>   pr(a,b,c) --> nil 2 3
> end
> end
>
> Ciao, ET.

in-do-end only seems to be interesting for sandboxing with stack-based
rather than function-based environments. (I'm thinking that terminology
may be more descriptive than "dynamic scoping".)

Mark