I recently defined a copy
method for an XML.jl Node
. I thought I was doing the right thing to avoid deepcopy
.
Node
s in XML.jl are immutable but they may contain some mutable elements, one of which may be a set of nested vectors of child Nodes
. To copy a Node
, it is also necessary to copy all it’s children. So my copy
is not shallow.
I am working with XML to manipulate Excel .xlsx
files. I have a library of Node
s in a Dict
to provide a set of common Excel features and these each includes nested child Node
s. To add one to an xlsx
file, I copy the Node
from the library and then insert it into the internal XML structure of the xlsx
file.
I can call the function I use to make a duplicate of the Node
in the library anything I want, but functionally, I am making a copy. Is this to be frowned upon? And if so, what should I do instead? Just rename the function?