Sending a message is a two-step process:
doesNotUnderstand:
is sent to the receiver
node1 coucou: #stef
coucou:
looked up in Node
Node
-> continues in Object
Object
-> send doesNotUnderstand:
to node1
doesNotUnderstand:
looked up in Node
Node
-> continues in Object
doesNotUnderstand:
is found and executed
doesNotUnderstand:
is a message
When no class redefines doesNotUnderstand:
doesNotUnderstand:
in Object
is executedMessageNotUnderstood
exception
MessageNotUnderstood
is just an exception, code can handle it:
Node >> sayHello
self coucou: #stef
Node >> welcome
[ self sayHello ]
on: MessageNotUnderstood
do: [ Transcript show: 'Something went wrong with a message' ]
doesNotUnderstand:
when it can not find a methoddoesNotUnderstand:
raises an exception that can be handled/