Shallow Copy
noun
say it: “SHAL-oh KOP-ee” /ˈʃæloʊ ˈkɑpi/
A copy of an object whose fields still point at the same lists and objects as the original.
What is a shallow copy?
A shallow copy copies an object's fields as they are, so a field that points at a list still points at the original's list. Add a box to the copy's list and the original gets it too. C#'s with, Python's copy.copy and JavaScript's spread ({ ...shipment }) all make shallow copies.
In a sentence
- “The copy was a shallow copy, so this week's extra box showed up in last week's shipment too.”
Level: Journeyman · More Software Development terms at this level
Updated