Skip to content

careful implementation of deepcopy #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
CarloLucibello opened this issue Dec 29, 2022 · 0 comments
Open

careful implementation of deepcopy #11

CarloLucibello opened this issue Dec 29, 2022 · 0 comments

Comments

@CarloLucibello
Copy link
Collaborator

Should overlad deepcopy_internals:

help?> deepcopy
search: deepcopy

  deepcopy(x)

  Create a deep copy of x: everything is copied recursively, resulting in a fully independent object. For example,
  deep-copying an array produces a new array whose elements are deep copies of the original elements. Calling
  deepcopy on an object should generally have the same effect as serializing and then deserializing it.

  While it isn't normally necessary, user-defined types can override the default deepcopy behavior by defining a
  specialized version of the function deepcopy_internal(x::T, dict::IdDict) (which shouldn't otherwise be used),
  where T is the type to be specialized for, and dict keeps track of objects copied so far within the recursion.
  Within the definition, deepcopy_internal should be used in place of deepcopy, and the dict variable should be
  updated as appropriate before returning.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant