[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: a new proposal for environments
- From: "Robert G. Jakabosky" <bobby@...>
- Date: Thu, 25 Feb 2010 22:27:39 -0800
On Thursday 25, Mark Hamburg wrote:
> How does this interact with string.dump and the corresponding load
> operation?
>
> Lightroom currently spawns alternate universes by taking a function to run,
> checking that it has no upvalues, dumping it, transferring that string to
> the newly created universe, loading it, and executing it.
>
> While I like the general tenor of the proposed change, I can see two
> potential problems for what Lightroom is doing. The first is that the
> function will now have an upvalue if it references any globals. The second
> is that I don't know how that upvalue will get bound when doing the load on
> the other side.
The dumped function would mostlikely have a flag "needs_environment"
or "has_globals" (just like the "is_vararg" flag), which would tell the
loader to bind the first upvalue to the environment. I think functions that
only have an environment upvalue, can be treated as if they didn't have any
upvalues.
I really like this new environment proposal.
--
Robert G. Jakabosky