Multiple distinct objects: Difference between revisions

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, exceptinstead by deliberately storingstore an index to another table that stores the objectsobject, rather than the object itself. Also, apart from low-level trickery and interfacing to shared libraries, there are no pointers to normal hll objects. Sequences need not be homogeneous, they can contain any type-mix of elements.
than the object itself. Also, apart from low-level trickery and interfacing to shared libraries, there are no pointers to normal hll objects. Finally, sequences need not be homogeneous.
<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}}==
7,796

edits