multiple `alias this` suggestion

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Fri Apr 21 05:17:28 PDT 2017


On 04/20/2017 04:35 PM, Carl Sturtivant wrote:
> On Wednesday, 19 April 2017 at 18:32:43 UTC, Carl Sturtivant wrote:
>> Imagine the existing single `alias this` is extended to provide such a
>> heierarchy of lookups. For example,
>>
>> struct top
>> {
>>     mem3 m3;
>>     mem2 m2;
>>     mem1 m1;
>>     alias m3, m2, m1 this;
>>     // ...
>> }
>>
>> could be interpreted to mean search for a name in m3 if not found in
>> top, and in m2 if not found in m3 and in m1 if not found in m2. I
>> don't back the syntax, just the notion.
>>
>> Maybe that's not all that's expected from "multiple alias this" but it
>> would be a clean step forward. Issues?
>
> No issues then!
> Time for a D I P perhaps.
> Comment?

This is interesting, and would be timely to discuss before an 
implementation of multiple alias this gets started. -- Andrei



More information about the Digitalmars-d mailing list