Re: [Phix] Question About Assignment
- Posted by petelomax Nov 09, 2021
- 768 views
specific to the calling instance.
That is precisely what reference counts implement: routines are passed references to the same data, but if the
reference count is >1 then attempts to modify it must first clone it, which is what copy-on-write semantics means.
However the reference counts themselves, which your typical hll code cannot (easily) see, are effectively shared.
Integers are not reference counted, but floating-point values and of course strings and sequences are.
Remember: there are exponential performance gains from shared reference counts in the same thread, all this
is only important for programs that actually invoke create_thread(), except for (as being discussed) some minor
precautionary steps bleeding into single thread cases, which I claim are pretty insignificant.
Slightly related: does the same hold for OE's tasks?
Technically yes, but since tasks will not and in fact absolutely cannot possibly inc/dec refcounts at the same time, not an issue.