[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: a new proposal for environments
- From: Pierre-Yves Gérardy <pygy79@...>
- Date: Sat, 27 Feb 2010 01:09:26 +0100
>> 3) Inspect which upvalues are used in the resulting function, and use
>> debug.upvaluejoin to convert these faux upvalues in resulting function
>> into the real ones you identified in the call stack.
At first I though it was possible to do that in 5.1 too, but, if I
understand properly, the only way to get this behaviour is by making
an __index metamethod for the "loaded" chunck that will fake upval
access at runtime. Too slow for me ATM. I hope we'll get a 5.2work3
soon.
> module 'upvals'
> local x,y = 10,20
> function one() return x end
> function two() return y end
>
> Say we want to recompile 'one' later so that it returns x+y; we have
> to look at the upvalues of all of the other module functions to find a
> reference - in this case y can be accessed through 'two'.
What about this?
function lexicalScopePlaceHolder()
error("I'm not meant to be called")
return x, y, z
end
-- Pierre-Yves
- References:
- a new proposal for environments, Roberto Ierusalimschy
- Re: a new proposal for environments, Sam Roberts
- Re: a new proposal for environments, Roberto Ierusalimschy
- Re: a new proposal for environments, Pierre-Yves Gérardy
- Re: a new proposal for environments, Roberto Ierusalimschy
- Re: a new proposal for environments, Pierre-Yves Gérardy
- Re: a new proposal for environments, Roberto Ierusalimschy
- Re: a new proposal for environments, steve donovan
- Re: a new proposal for environments, Peter Cawley
- Re: a new proposal for environments, steve donovan