Deprecating this(this)

Kagamin spam at here.lot
Mon Apr 2 14:01:22 UTC 2018


On Sunday, 1 April 2018 at 14:31:24 UTC, Andrei Alexandrescu 
wrote:
> 1. For immutable objects, typechecking in the presence of 
> successive modifications of data (first assignment by the 
> compiler, then modification by the user) is very difficult if 
> not impossible. I don't know how to do it. The single 
> initialization model (raw/cooked) used currently in regular 
> immutable constructors works reasonably well and is robust.

Do the same as in const constructor.

> 2. For shared objects, the part done by the compiler and the 
> part done by this(this) should be synchronized together. This 
> makes it impossible for the user to e.g. define a struct that 
> gets copied atomically.

If you mean reference counting, the easy solution with copy 
constructor is bad performance wise. Good solution can be done 
architecturally now and doesn't rely on copy constructor.


More information about the Digitalmars-d mailing list