draft proposal for ref counting in D

Walter Bright newshound2 at digitalmars.com
Wed Oct 9 19:21:05 PDT 2013


On 6/28/2013 1:55 AM, Rainer Schuetze wrote:
 >
 > What happens if the class also implements interfaces? A reference of the 
interface type must do reference counting as well. So the interface must also 
define AddRef and Release. This is currently true for COM-interfaces derived 
from IUnknown, but not for other interfaces.
 >
 >

Even implementing IUnknown is a problem, if we do the suggestion that opAddref 
and opRelease be used as wrappers around AddRef and Release.

I think the simplest thing is to not allow ref counted classes to implement 
interfaces other than ones derived from IUnknown.



More information about the Digitalmars-d mailing list