Re: LuanTable constructors

Posted by fschmidt on
URL: https://old-forum.luan.software/LuanTable-constructors-tp91p100.html

Hugo <Nabble> wrote
This is a minor issue, so it is okay for now. It seems to me that LuanTable would be more flexible if it held a collection like I suggested (instead of a List). I am also not sure why you force <Objects> instead of <? extends Object>. But you can decide about this because I don't understand the code well enough.
I can't add objects to a List<? extends Object> because the Java compiler doesn't know what types of objects the list accepts.

Besides that, I believe you would be able to simplify the (deep)cloning code by using serialization/deserialization to/from byte code. Cloning the entire graph of objects would be just a few lines of code, but would require objects to implement the Serializable interface. Did you consider that option?
This doesn't work because I copy references to non-cloneable objects without cloning them.  For example, the compiled Luan code-tree is non-cloneable and is shared by all clones.
Woe to those who call bad good and good bad -- Isaiah 5:20
Following the Old Testament, not evil modern culture