Shallow copy of an arbitrary mutable object

Hi there,
is there any method to perform a shallow copy of a mutable object?

My attempt of Base.copy(obj) failed with an error MethodError: no method matching copy(::MyArbitraryType)

I think Base.copy may be the responsibility of the implementer of the type to implement. Base.deepcopy is “automatically generated” but this is because the concept of deepcopy is well-defined, but what exactly is shallow is a little more hazy:

Create a shallow copy of x: the outer structure is copied, but not all internal values.


Create a deep copy of x: everything is copied recursively, resulting in a fully independent object.