Issue

Jarrett Billingsley kb3ctd2 at yahoo.com
Tue Jul 22 06:38:07 PDT 2008


"bobef" <bobef at nosmap-abv.bg> wrote in message 
news:g64mei$1vu4$1 at digitalmars.com...
> Some more problems on this matter. This tries to invoke TST.ASD instead of 
> .ASD :
>
> void ASD(char[] a,int b)
> {
> }
>
> class TST
> {
> this(){"asd".ASD(5);}
> void ASD(){}
> }

This is behaving correctly.  Remember that "asd".ASD(5) is just sugar for 
ASD("asd", 5).  Name lookup in D proceeds from the innermost scope, so the 
first ASD it finds, it tries to use.  It's exactly the same as when you try 
to do something like:

char[] toString()
{
    return toString(someMember) ~ ", " ~ toString(otherMember);
}

and the compiler complains about not using the right params to toString. 




More information about the Digitalmars-d-bugs mailing list