I want to add a Phobos module with template mixins for common idioms.
Dmitry Olshansky
dmitry.olsh at gmail.com
Fri May 24 13:08:37 PDT 2013
24-May-2013 22:13, Jonathan M Davis пишет:
> On Friday, May 24, 2013 17:42:59 Dmitry Olshansky wrote:
>> There was a pull that allowed to separate qualifier of instance from
>> reference (handle) looking like this:
>>
>> ref const(Object) refToConst;
>>
>> ref Object mutableTlsRef;
>> Object mutableTlsRef; //same as above
>>
>> ref const Object constRefToConst;
>> const Object constRefToConst; //ditto
>>
>> The fact that we don't have it is part of the reason I don't like doing
>> OOP in D at all.
>
> Lacking a proper language solution, we could create something similar to
> Rebindable but for shared.
>
Then in my vision built-in OOP has failed if we need at least 2 wrapper
types implemented as structs on top of built-in refs. Then recall (to be
implemented) RefCounted!ClassType and we have yet another library land
solution to make OOP types with ref-counting.
On occasion I've been enumerating the amount of special casing class
references require and truth be told I fail to see the benefit of having
them as built-in outweigh the cost. With multiple alias this I could
have implemented the OOP in library just fine as Ref!T struct. Then
Ref!(const(T)) is ConstRef!T
Ref!(shared(T)) is SharedRef!T
And now UDAs can serve for override/virtual, inheritance etc.
> - Jonathan M Davis
--
Dmitry Olshansky
More information about the Digitalmars-d
mailing list