Is this intended behavior?
Jarrett Billingsley
kb3ctd2 at yahoo.com
Sun Aug 10 07:16:22 PDT 2008
"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?
More information about the Digitalmars-d
mailing list