DIP74: Reference Counted Class Objects

anonymous via Digitalmars-d digitalmars-d at puremagic.com
Thu Feb 26 23:44:18 PST 2015


On Friday, 27 February 2015 at 00:10:00 UTC, deadalnix wrote:
> 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
>
> "The compiler detects automatically and treats specially all 
> classes and interfaces that define the following two methods:"
>
> Well, RefCounted could use compile time reflexion to do so. 
> Even better, we could define a lvalue property for RefCounted 
> to use a counter so we can do intrusive counting in both 
> classes and structs.
>
> "@safe code may not issue explicit calls to opAddRef/opRelease. 
> "
>
> I guess we could simply make them @system .
>
> " RCOs objects are subject to additional limitations compared 
> to their GC counterparts:
>
> No conversion to Object or interfaces that are not reference 
> counted "
>
> No problem, I'm gonna duplicate all my code and as will every 
> single library writer out there.
>
> Missing:
>
> All write of RCO reference to statics must be atomic and 
> ordered as long as the language can't enforce thread locality 
> (at least in @safe code).
>
> Generally:
> This DIP works around (announced) limitations of DIP25. As 
> escape can only be checked properly for type with no 
> indirections, and only solve the problem for 
> classes/interfaces. Other type with indirection remains an 
> unsolved problem.
>
> If I were in charge, that would be a clear no, and the sign 
> that DIP25 approach needs to be reworked, as wack-a-mole is not 
> a good way to handle design.

We all pray you become less of a gaping asshole before youre in
charge of anything.


More information about the Digitalmars-d mailing list