deepcopy sometimes leads to bugs that I don’t understand. Instead, I reconstruct my object from scratch in such cases.
As an aside, this is another example of explicit parameter frameworks (e.g. Lux.jl and SimpleChains.jl) being simpler to work with and understand.
But I agree that with implicit parameters,
copy should be defined to also copy these underlying parameter arrays.