Deprecating this(this)

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Apr 3 12:45:13 UTC 2018


On 04/02/2018 02:47 PM, Marco Leise wrote:
> Am Mon, 2 Apr 2018 11:57:55 -0400
> schrieb Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org>:
> 
>> 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
> 
> You are hitting a prominent type system flaw here. What may
> look like a hurdle on the path to fix this(this) is also at
> the core of getting "shared" into a good shape and probably
> affects how we will discuss "immutable destructors" and their
> kin in the future. The question is "How transitive is a
> qualifier when we strip it top-level on an aggregate?"

Roger. My hope is to solve that for primitive types, then use that to 
typecheck constructors and destructors, then use the signatures of 
(typechecked) constructors and destructors to address composition. 
Ideally we'd get away without defining another kind of qualifier - 
@tail(const) or whatever. That would complicate the language a great deal.


Andrei



More information about the Digitalmars-d mailing list