[Pharo-users] Java "this" against our "thisContext"

Benjamin benjamin.vanryseghem.pharo at gmail.com
Tue Mar 25 06:30:49 EDT 2014


Within an instance method or a constructor, this is a reference to the current object — the object whose method or constructor is being called. You can refer to any member of the current object from within an instance method or a constructor by using this.

from: http://docs.oracle.com/javase/tutorial/java/javaOO/thiskey.html

thisContext in smalltalk points to the execution context of the method being currently evaluated.
So definitely this and self are the “same” (as long as we do not talk about inner classes)

thisContext does not exist in Java AFAIK

Ben

On 25 Mar 2014, at 11:27, Sergi Reyner <sergi.reyner at gmail.com> wrote:

> Hi everyone,
> 
> I had a pretty heated IRC debate yesterday about how Smalltalk´s reflection facilities are superior to those of Java, in the sense that they operate at a higher level (I started it pasting one of those crazy snippets that got posted to the list xD). It somehow slowly degenerated into someone trying to convince me that Java's "this" operator is equivalent to "thisContext", instead of "self".
> 
> My intuition says that´s wrong, but I´d very much like someone familiar with both to offer an explanation to this poor unenlightened person :D
> 
> Cheers,
> Sergi
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-users_lists.pharo.org/attachments/20140325/8b895a81/attachment.html>


More information about the Pharo-users mailing list