Multiple distinct objects: Difference between revisions
→{{header|Phix}}
Line 878:
Phix uses shared reference counts with copy-on-write semantics. Creating n references to the same mutable object is in fact the norm,
but does not cause any of the issues implicitly feared in the task description. In fact, it is not possible to create shared references
such that when one is updated they all are,
<lang Phix>sequence s = repeat("x",3*rand(3))
?s
Line 895 ⟶ 894:
{"xy",{"xy","x","x","x","x",5},"x","x","x",5}
</pre>
I suppose it is possible that someone could write
<lang Phix>sequence s = repeat(my_func(),5)</lang>
and expect my_func() to be invoked 5 times, but for that you need a loop
<lang Phix>sequence s = repeat(0,5)
for i=1 to length(s) do
s[i] = my_func()
end for</lang>
=={{header|PicoLisp}}==
|