🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #8282

Re: Qualifier this recommended?

#8282
From: Torsten Welches
Date: Thu, 05 Apr 2001 13:19
40 lines
2053 bytes
Hartmut,

there are situations where a this matters, e.g. if you have an
instance variable and a local variable or parameter with the 
same name:

..
private String name;
..
public void setName(String name) {
  this.name = name;
}

Of cause I'd recommend to choose a distinct parameter name like 
"newName"... ;-)

Prefixing an instance method call with "this." is always 
redundant, but sometimes "more clear". It's a question of taste.

Torsten

"Hartmut" <hartmut.kiessling@bnhof.de> wrote:
>Hi,
>
>in the frame class generated by JBuilder I see some method calls like
>this.setTitle( ... );
>though qualifier this wouldn't be necessary, as far as I see.
>
>So is it true, that you never need to qualify the call of a class own or
>inherited method with "this", or is there anything I oversee here?
>If true, what do you think: should it be used anyway to documentate that
>it's a method call for the object itself, and to have search pattern to look
>for such calls?
>
>Regards,
>Hartmut
>
>
>
Technical Details
Message-ID: <3acc70f9$1_2@dnews>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!newsfeed.direct.ca!look.ca!newsfeed.icl.net!dispose.news.demon.net!demon!diablo.netcom.net.uk!netcom.net.uk!fr.clara.net!heighliner.fr.clara.net!fr.usenet-edu.net!usenet-edu.net!fu-berlin.de!news.boerde.de!dnews
References: <3acc5638_2@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,6b0783fc59091784
X-Google-Attributes: gidf74b3,public
X-Google-ArrivalTime: 2001-04-05 06:42:10 PST
From: "Torsten Welches" <torsten.welches@who.cares.netcologne.de>
Sender: "Torsten Welches" <torsten.welches@who.cares.netcologne.de>
Reply-To: "Torsten Welches" <torsten.welches@who.cares.netcologne.de>
Subject: Re: Qualifier this recommended?
Newsgroups: borland.public.jbuilder.java.language
X-User-Info: 193.158.55.74 193.158.55.74    
References:  <3acc5638_2@dnews> 
NNTP-Posting-Host: 207.105.83.65
Message-ID: <3acc70f9$1_2@dnews>
Date: 5 Apr 2001 06:19:53 -0700
X-Trace: dnews 986476793 207.105.83.65 (5 Apr 2001 06:19:53 -0700)
Lines: 41
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!newsfeed.direct.ca!look.ca!newsfeed.icl.net!dispose.news.demon.net!demon!diablo.netcom.net.uk!netcom.net.uk!fr.clara.net!heighliner.fr.clara.net!fr.usenet-edu.net!usenet-edu.net!fu-berlin.de!news.boerde.de!dnews