On 25 mars 2014, at 11:30, Benjamin <benjamin.vanryseghem.ph...@gmail.com> 
wrote:

> 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

You can get a reification of the stack with simple introspection (get the 
method, class or file name and the line number) with 
Thread.currentThread().getStackTrace()
But this is far from the fully reflective Smalltalk stack and the advanced 
manipulations it enables. 

> 
> Ben
> 
> On 25 Mar 2014, at 11:27, Sergi Reyner <sergi.rey...@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
>> 
> 

Reply via email to