[Dlang-study] [lifetime] Few root decisions to take on RC classes
Andrei Alexandrescu
andrei at erdani.com
Sun Nov 1 06:02:47 PST 2015
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.
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.
Andrei
More information about the Dlang-study
mailing list