DIP74: Reference Counted Class Objects
Orvid King via Digitalmars-d
digitalmars-d at puremagic.com
Fri Feb 27 15:22:44 PST 2015
From the perspective of someone mostly indifferent to the support
for it:
Why does DIP74 require the references to be counted on
assignment? Shouldn't it be defined such that reference counting
operations only need to occur when an unbalanced or escapable
reference is created? This would eliminate a large number of the
required references. As long as the reference count of an object
is the same entering a function as when it leaves the function,
there's no need to do a bunch of twiddling in the middle.
It also appears to me that the opAddRef in the examples is
simpler than it should be. I believe it should be doing an
`assert(_refs)` first, to ensure a valid state entering into the
function.
Lastly, I believe it should be opReleaseRef rather than
opRelease, simply to be explicit on what is being released.
More information about the Digitalmars-d
mailing list