[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Using lexical environments (was setfenv/getfenv)
- From: Tony Finch <dot@...>
- Date: Tue, 12 Jan 2010 19:34:39 +0000
On Tue, 12 Jan 2010, Nevin Flanagan wrote:
>
> My biggest concern remains the challenge of getting values in or out of
> an "in" block. Right now the only ways to get a value out are to either
> extract it from the environment table or create a local before the block
> where it can leave its result; is there any hope for a way to pass
> values in and out via the stack, much as coroutine.resume and
> coroutine.yield do?
What's wrong with wrapping the block in a function?
> This would also help us solve the problem of wrapping code that is not
> informed about a specialized environment but expects arguments:
How about
in (...) do return (function (...)
body
end)(select(2, ...)) end
Tony.
--
f.anthony.n.finch <dot@dotat.at> http://dotat.at/
GERMAN BIGHT HUMBER: SOUTHWEST 5 TO 7. MODERATE OR ROUGH. SQUALLY SHOWERS.
MODERATE OR GOOD.