DIP66 - Multiple alias this

Daniel N via Digitalmars-d digitalmars-d at puremagic.com
Mon Oct 13 08:21:31 PDT 2014


>>> On 10/11/2014 7:23 AM, IgorStepanov wrote:
>>>> class A
>>>> {
>>>>  int i;
>>>>  alias i this;
>>>> }
>>>>
>>>> class B
>>>> {
>>>>  int i;
>>>>  alias i this;
>>>> }
>>>>
>>>> class C
>>>> {
>>>>  A a;
>>>>  B b;
>>>>  alias a this;
>>>>  alias b this;
>>>> }

My preferred solution would be to reject the 2nd alias 
declaration outright.

I don't see any value in intentionally creating the above 
pattern, _if_ it occurs then it's most likely due to an 
unintentional side-effect of a re-factoring, thus it should error 
out as close as possible to the real error.



More information about the Digitalmars-d mailing list