[Dlang-study] [lifetime] Initial thoughts on lifetime management
Andrei Alexandrescu
andrei at erdani.com
Wed Oct 28 08:07:32 PDT 2015
On 10/28/2015 09:44 AM, Timon Gehr wrote:
> opInc and opDec are still useful. E.g. one could @disable opInc to
> obtain unique class references. (opInc and opDec are basically just
> class reference based versions of this(this) and ~this().)
Noted.
> How does the compiler lose control with opInc/opDec? It could still fuse
> them.
Fusing them relies on the compiler knowing the effects are additive
(three successive opInc()s mean += 3 etc) and also that opInc() and
opDec() cancel each other. Allowing the user to define them arbitrarily
prevents the compiler from doing some of these things, or limits what
the user can do drastically enough to just mandate one implementation.
> If we want to be able to elide the vptr, I don't think a common root
> class can work.
Makes sense.
> How to specify the allocator for a @rc class?
I don't know, it's a good topic for discussion. Ideas?
Andrei
More information about the Dlang-study
mailing list