[Dlang-study] [lifetime] Few root decisions to take on RC classes
deadal nix
deadalnix at gmail.com
Sun Nov 1 11:16:53 PST 2015
2015-11-01 6:02 GMT-08:00 Andrei Alexandrescu <andrei at erdani.com>:
> On 10/31/2015 11:35 PM, Michel Fortin wrote:
>
>> I think it'd be more important to talk about auto-nulling weak
>> references. That's a general concept that is necessary if you want
>> reference counting to be useful and safe at the same time.
>>
>
> Agreed. We need to put weak pointers in the initial DIP and carry them
> through.
>
>
It' doesn't looks like this kind of mechanism should be baked into the
language. It come with a cost that maybe one doesn't want to pay. Maybe one
is ok to fallback on the GC on that one. Maybe it is preferable to provide
several kind of RC. Adn weak reference are just one variation one may wish.
> Regarding opInc/opDec, here are some rules that the compiler may use:
>
> * Both are callable with an unsigned integer, 1 by default
> * opInc(n) followed by opDec(n) against the same object, with no call to
> isUniquelyReferenced in between, may be removed
> * opInc(n1) followed by opInc(n2) against the same object may be replaced
> with opInc(n1 + n2)
> * opDec(n1) followed by opDec(n2) against the same object may be replaced
> with opDec(n1 + n2)
>
> I'm trying to formalize a bit what removals and fusing the compiler should
> be allowed.
>
>
Using intrinsic would sidestep this completely, even allowing to have
several schemes.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/dlang-study/attachments/20151101/8ab5af55/attachment-0001.html>
More information about the Dlang-study
mailing list