Is this intended behavior?

Jacob Carlborg doobnet at gmail.com
Sun Aug 10 13:58:18 PDT 2008


Jarrett Billingsley wrote:
> "Jacob Carlborg" <doobnet at gmail.com> wrote in message 
> news:g7mqd2$2rab$1 at digitalmars.com...
>> downs wrote:
>>> Try .id
>> Yeah that works but I'm porting a library from Java to D so it breaks the 
>> interface and I have to replace every "id" with ".id". For now I have 
>> changed the member variable to "id_" then I can do a global search and 
>> replace for "this.id" and replace to "this.id_". I've solved my problem 
>> but I was wondering if this was the intended behavior or a bug.
> 
> It's intended behavior.  Name lookup happens from the innermost scope 
> outwards, and does not depend upon how the name is used.  Since 'id' is a 
> member of the class, it finds that first, rather than the class 'id'.  Maybe 
> Java keeps looking for another name 'id' that can be used as a type? 
> 
> 

Tanks for that answer.



More information about the Digitalmars-d mailing list