lua-users home
lua-l archive

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


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