DIP74: Reference Counted Class Objects

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Thu Feb 26 23:22:41 PST 2015


On Thu, Feb 26, 2015 at 06:39:12PM -0800, Andrei Alexandrescu via Digitalmars-d wrote:
> On 2/26/15 6:21 PM, H. S. Teoh via Digitalmars-d wrote:
> >On Thu, Feb 26, 2015 at 06:06:04PM -0800, Andrei Alexandrescu via Digitalmars-d wrote:
> >>On 2/26/15 5:59 PM, H. S. Teoh via Digitalmars-d wrote:
> >>>On Thu, Feb 26, 2015 at 05:44:36PM -0800, Andrei Alexandrescu via Digitalmars-d wrote:
> >>>[...]
> >>>>An interesting option to explore in the future would be rigging
> >>>>druntime to add opAddRef and opRelease to Object.
> >>>[...]
> >>>
> >>>How would that work? Doesn't that immediately subject *all* classes
> >>>to the restrictions set forth in DIP74?
> >>
> >>It does - but that might be fine with some applications. -- Andrei
> >
> >But putting it into druntime imposes it on *all* applications,
> >because either opAddRef/opRelease are declared in Object, or they are
> >not, and this decision is made long before the user writes his
> >application.
> 
> That's why I used "rigging" - meaning "equip for special purpose".
> "Hacking" is clearer. Someone may decide to just add
> opAddRef/opRelease to Object for a system or application. Or make the
> addition subject to a versioning flag (and therefore have two druntime
> builds available).
[...]

Ahhh, I see what you mean now. That's an interesting idea... I suppose
people like Manu could like to do something like this to get ARC by
default, for example.


T

-- 
Do not reason with the unreasonable; you lose by definition.


More information about the Digitalmars-d mailing list