Multiple alias this, what's the hold up?

Timon Gehr timon.gehr at gmx.ch
Sun Jun 16 23:33:08 UTC 2019


On 17.06.19 00:28, Adam D. Ruppe wrote:
> On Sunday, 16 June 2019 at 22:14:19 UTC, Walter Bright wrote:
>> On 6/16/2019 7:39 AM, Timon Gehr wrote:
>>> No. It's multiple imports.
>>
>> D already has multiple imports with template mixins. If multiple 
>> imports is what people want, it's already there.
> 
> Actually, I'll disagree with both of you. I think alias this is really 
> about enabling implicit conversion to the type of alias this. And 
> multiple implicit conversion is obviously useful.
> ...

Sure, it does that too, but this doesn't really inform the design. 
(Furthermore, I think it is actually pretty annoying that those two 
aspects of `alias this` are mixed together into the same language feature).
And anyway, right now, alias this is a bad mechanism for this because it 
does not allow introspection on the expected type to generate code that 
performs the conversion. If there was just general 
expected-return-type-based IFTI (instead of just for non-aliased 
template function literals), single alias this would suffice for your 
use case.


More information about the Digitalmars-d mailing list