Deprecating this(this)

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Apr 2 15:57:55 UTC 2018


On 04/02/2018 10:59 AM, ag0aep6g wrote:
> 
> That wouldn't be possible if `innocent` were only head-mutable in the 
> postblit function, instead of fully mutable as it is currently (bug).
> 
> `innocent` would be typed as `immutable(int)[]`, and you could not 
> assign it to the fully mutable `sneaky`.

Problem is we don't have head-mutable in the language. Yes, for built-in 
slices the mechanism is simple - just change qualifier(T[]) to 
qualifier(T)[]. For a struct S, there is no way to convert from 
qualifier(S) to tailqualifier(S).

I plan to attack this directly in the DIP - provide a way for structs to 
express "here's what implicit conversion should be applied when doing 
template matching".

Andrei


More information about the Digitalmars-d mailing list