DIP53 and DIP49 (ver2) - New definitions for qualified constructors and postblits
Timon Gehr
timon.gehr at gmx.ch
Fri Dec 20 14:40:15 PST 2013
On 12/18/2013 04:42 AM, Kenji Hara wrote:
> http://wiki.dlang.org/DIP53
> Redesign currently implemented qualified constructor concept.
> ...
Roughly speaking, this DIP just removes a language feature and changes
the syntax of another feature to something less descriptive. I think
implementing this is a net loss.
> http://wiki.dlang.org/DIP49
> Improved points from version 1:
> - Swap meanings of 'this(this) inout' and 'this(this) const'
> - Inout postblit now covers all cheap (== not rebind indirections)
> copies between same qualifiers
>
> Kenji Hara
What about just mentioning the qualifiers of source and target of the
copy explicitly?
this(this){ ... } // mutable source, mutable target
this(immutable this){ ... } // immutable source mutable target
this(const this)immutable{ ... } // const source, immutable target
this(const this)const{ ... } // const source, const target
// ...
this(inout this)inout{ ... } // source and target have the same qualifier
// ...
this(this)inout{ ... } // mutable source, arbitrary target
// ...
this(const this)inout{ ... } // const source, arbitrary target
Whenever source and target are (potentially) incompatible, the postblit
ensures that all fields with incompatible types in source and target are
reinitialized.
Only unique expressions convert to 'inout' anyway, hence the last
signature above would correspond to unique postblit in the current proposal.
This would be more explicit, strictly more expressive and require less
special casing in the compiler implementation.
More information about the Digitalmars-d
mailing list