> However, could you please explain to me what is involved in updating dict? > I understand an ObjectIdDict is a hash table whose keys are object ID's. > But the documentation doesn't tell me how to generate such a key for my > object, nor what value to insert in the dict when overloading > deepcopy_internal. I presume the object itself is used as the key? But what > value should be inserted?
Looking at the code in Base: julia> @less Base.deepcopy_internal([1,2], ObjectIdDict()) suggests to me that the key is the object to be copied and the value is the copy. Aside: the function should be renamed to deepcopy_internal! as it modifies the dict. > On 25 February 2016 at 21:01, Yichao Yu <[email protected]> wrote: > >> On Thu, Feb 25, 2016 at 2:57 PM, Toivo Henningsson <[email protected]> >> wrote: >> > It seems very reasonable that you should be able to overload deepcopy >> for a given type, and that if that has to be done on a specific way, it >> should be mentioned in the documentation for deepcopy. Open an issue? >> >> Please read the doc first. >> >> overloading deepcopy is supported and documented >> >> >> http://julia.readthedocs.org/en/latest/stdlib/base/?highlight=deepcopy#Base.deepcopy >>
