[Tutor] self self self

alan.gauld@bt.com alan.gauld@bt.com
Wed, 19 Jul 2000 11:40:27 +0100

> in java classes, the 'self' namespace is automatically
> available.  instance methods automatically include the self ('this' in

> Is there any good and reasonable way to circumvent having to include


> not, what's the likelihood of the language adding an 
> automatic search in
> the class' (object's) namespace in the future?

Low, I should imagine. A goodly proportion of Python programmers value 
the extra clarity that explicitly using self provides. In my case to 
the point that I now routinely use 'this->' in front of all self 
messaging in C++. 

Of course in Java it's possibly less confusing since you can't have 
global functions so theres no uncertainty about where the 
function/method resides. But in C++ self messaging looks 
exactly like calling a global function and it gets very confusing 
for the poor maintenance programmer! explicit self/this avoids 
the ambiguity.

Alan G.