[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Deep Copy prototype
- From: "Wim Couwenberg" <w.couwenberg@...>
- Date: Wed, 7 May 2003 11:59:02 +0200
Brad Olson wrote:
> Did I assume right about what can
> and cannot be copied?
Some more remarks to add to those of BSH and LHF:
- Lua functions are _mutable_ objects (their environment can be changed)
but I can't think of a way to make a copy of one. So that's a real problem.
- Copying a table should at least take its metatable into account. Whether
or not you should deep-copy the metatable will depend on the application you
have in mind I guess. If the metatable is protected then this is another
no-go...
- It seems fair to deep-copy a table's _keys_ as well as its values.
- For each original object, exactly one deep-copied object should be
produced. (This extends the "cyclic tables" issue mentioned by BSH.)
Bye,
Wim