Darren New wrote:

> Eliot Miranda wrote:
> 
>> can only actually carry-out operations on objects that implement them. 
> 
> 
> Execpt that every operation is implemented by every object in Smalltalk. 

No they are not.  Objects implement the methods defined by their class 
and (inherit) those implemented by the class's superclasses.  Note that 
classes do _not_ have to inherit from Object, and so one can create 
classes that implement no methods at all.  It is a common idiom to 
create a class that implements two methods, an initialization method and 
a doesNotUnderstand: method, so create a transparent proxy that 
intercepts any and all messages sent to it other than the initialization 
method (*).

[(*) With suitable hackery (since Smalltalk gives access to the 
execution stack through thisContext) one can also invoke 
doesNotUnderstand: if the initialization message is sent from any object 
other than the class.]

> Unless you specify otherwise, the implementation of every method is to 
> call the receiver with doesNotUnderstand.  (I don't recall whether the 
> class of nil has a special rule for this or whether it implements 
> doesNotUnderstand and invokes the appropriate "don't send messages to 
> nil" method.)

No.  The run-time error of trying to invoke an  operation that isn't 
implemented by an object is to send the doesNotUnderstand: message. 
This is another attempt to invoke an operation, i.e. whatever the 
object's doesNotUnderstand: method is, if any.  If the object doesn't 
implement doesNotUnderstand:, which is quite possible, then the system, 
will likely crash (either with an out of memory error as it goes into 
infinite recursion) or hang (looping attempting to find an 
implementation of doesNotUnderstand:).

> There are a number of Smalltalk extensions, such as 
> multiple-inheritance, that rely on implementing doesNotUnderstand.

Which has nothing to do with the separation between message send and 
method invocation, or the fact that doesNotUnderstand: is a message 
send, not a hard call of a given doesNotUnderstand: method.
-- 
_______________,,,^..^,,,____________________________
Eliot Miranda              Smalltalk - Scene not herd

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to