patch for $addrow needed?



> Yes, it's for copy on write: when refcount > 0 I have to copy
> the storage array before writing to it.
>
> The way the code is now written, the refcount may as well
> be just a flag to tell whether I own my storage array.
> But a more careful (more strongly optimizing) implementation
> would decrement all the refcounts when any reference
> goes away, and whoever has refcount = 0 becomes the
> effective owner. There is doubtless a very large literature on this.

There is certainly a literature on reference counts.  I'd think the
big problem would be maintaining them, since all events that change
reachability have to change reference counts.  That is why most
systems now (e.g. Java Virtual Machines) don't use reference counts,
but garbage collectors.

But all this is implementation.  I'd be interested to see your
proposal for the semantics of all this.  Is the intent to make all
arrays look like pure values, rather than objects? Assuming a good
semantic model can be defined, why is it so valuable that this
complicated implementation is necessary?

            -s