> Back to the original post, my preference is against "this.foo()"
> because I'd bet the compiler generates more bytecode for the "this."

Sorry, you are betting on the wrong horse. The Java Virtual Machine
Specification [1] defines the invokevirtual instruction to push on the
stack the receiver of the message. 

The option of not specifying 'this.' is a syntactic shortcut, it has no
semantic meaning.

The only time the receiver is not pushed on the stack is when a static
method is invoked with the invokevirtual instruction, in which case you
would not use the 'this.' syntax anyway (by convention, this is bad
form)

[1] http://java.sun.com/docs/books/vmspec/

Gary

> -----Original Message-----
> From: Sandy McArthur [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, March 07, 2006 8:07 PM
> To: Jakarta Commons Developers List
> Subject: Re: [lang] this.foo() vs. foo()
> 
> On 3/7/06, Phil Steitz <[EMAIL PROTECTED]> wrote:
> > On 3/7/06, Phil Steitz <[EMAIL PROTECTED]> wrote:
> > > On 3/7/06, Sandy McArthur <[EMAIL PROTECTED]> wrote:
> > > > On 3/7/06, Gary Gregory <[EMAIL PROTECTED]> wrote:
> > > > > In our product code bases, we use the "this.foo()" convention.
The
> > > > > argument being, that in object oriented programming, a message
is
> sent
> > > > > to an object, always.
> > > > >
> > > > > How does the list feel about cleaning up foo()'s to
this.foo()'s?
> > > > >
> > > > > I am willing to do this clean up, actually, I'll let Eclipse
do it
> ;)
> > > > >
> > > > > Or, we can leave it all as is, with some classes doing it one
way
> and
> > > > > others the other way.
> > > >
> > > > My position is that as you're working on a chunk of code, clean
it
> up
> > > > to whatever you like but DO NOT go changing code just for
cosmetic
> > > > sake.
> > > >
> > >
> > > Phil says +1 to the remark above.  Of course you could tell it is
Phil
> > > speaking by the from header and the sig below ;-)
> > >
> > > Phil
> >
> > Seriously, Craig makes an important point as does Gary (about the
code
> > being public).  I should not have responded categorically.  I
> > personally do not agree in this case, but agree that style changes
are
> > OK if community (meaning those actually maintaining the code base)
> > agree.
> >
> > Phil
> 
> I don't think there should ever be a sweeping code reformat if for no
> other reason than it obscures how recently a block of code has been
> reviewed by `svn blame`. I try to make commits that only change lines
> that I've thought about and will own up to regardles if they end up
> being good or bad.
> 
> Back to the original post, my preference is against "this.foo()"
> because I'd bet the compiler generates more bytecode for the "this."
> and because it doesn't really add anything unless you are using a text
> editor without syntax highlight and other built in Java intelligence.
> 
> --
> Sandy McArthur
> 
> "He who dares not offend cannot be honest."
> - Thomas Paine
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to