Deepcopy: Difference between revisions

No change in size ,  7 years ago
m
typo
m (>1levels)
m (typo)
Line 1,057:
Handled natively. Phix uses reference counting with copy-on-write semantics; the initial copy is fast even for huge complex and deeply nested structures (copying a single machine-word-sized reference and incrementing a single machine-word-sized reference count), and when a shared object (anything with a refcount>1) is modified, an internal clone of the minimum necessary levels occurs, with all the rest of the structure remaining shared (but obviously still properly protected in the same way).
<lang Phix>object a, b
a = {1,{2,3},"four",{5.6,7.,{8.9}}}
b = a
b[3] = 4
7,820

edits