DIP74: Reference Counted Class Objects

Zach the Mystic via Digitalmars-d digitalmars-d at puremagic.com
Fri Feb 27 05:48:09 PST 2015


On Thursday, 26 February 2015 at 21:50:56 UTC, Andrei 
Alexandrescu wrote:
> http://wiki.dlang.org/DIP74 got to reviewable form. Please 
> destroy and discuss.
>
> Thanks,
>
> Andrei

It's kind of funny that you were looking for an edge to my safety 
system -- I'll admit I don't know whether it really has an edge 
or not (it might be too bloated, both function-signature-wise and 
compile-time-wise) -- but one key advantage to any sophisticated 
ownership system is that automated reference counting can elide 
calls which it knows are unnecessary. What struck me in 
particular about DIP74 is how the pass-by-value protocol will 
force many function calls to endure an opAddRef/opRelease cycle, 
even if they do nothing to the reference count.

What really worries me is that if the caller is responsible for 
the opAddRef, while the callee is responsible for the opRelease, 
isn't the potential optimization of eliding them just being 
sacrificed?


More information about the Digitalmars-d mailing list