[Cuis-dev] catch of MessageNotUnderstood

Jaromir Matas mail at jaromir.net
Sun Jun 30 23:01:08 PDT 2024


Hi Mark,

On 01-Jul-24 1:25:59 AM, "Mark Volkmann" <r.mark.volkmann at gmail.com> 
wrote:

>I see that the defaultAction method in UnhandledError sends 
>#devDefaultAction to itself.
>That sends #activeProcess to the Processor class to get the current 
>process, but I don't see a Processor class.
>Where is that defined?
Yes, it's confusing...

Processor is the only instance of ProcessorScheduler class. Processor's 
name is capitalized because it's a global variable and all global are 
capitalized - all class names are also global variables, hence 
capitalized.

Similarly Smalltalk is an instance of SmalltalkImage class.

You can easily find out by inspecting the object, e.g. Processor inspect 
(or using CMD + i).

>
>
>
>On Sun, Jun 30, 2024 at 6:19 PM Mark Volkmann 
><r.mark.volkmann at gmail.com> wrote:
>>Thanks so much for explaining that!
>>
>>On Sun, Jun 30, 2024 at 5:48 PM Jaromir Matas <mail at jaromir.net> 
>>wrote:
>>>Hi Mark,
>>>
>>>
>>>On 30-Jun-24 11:48:16 PM, "Mark Volkmann via Cuis-dev" 
>>><cuis-dev at lists.cuis.st> wrote:
>>>
>>>>I'm studying how the doesNotUnderstand method is used. I see that 
>>>>the implementation in the Object class signals a 
>>>>MessageNotUnderstood error. But I haven't been able to find the code 
>>>>that catches that and opens a MessageNotUnderstood window. Where 
>>>>does that happen?
>>>A quick summary of events:
>>>
>>>1. VM sends doesNotUnderstand: message - in your particulr case the 
>>>one implemented in Object will be called
>>>2. Object's doesNotUnderstand: executes and signals 
>>>MessageNotUnderstood
>>>3. the signal method traverses the sender chain (= all contexts in 
>>>the execution stack, starting from the top, most recent) until it 
>>>finds a context containing a usable handler or, if there is no such 
>>>handler present, until it reaches the bottom of the stack - which is 
>>>nil
>>>4. then the signal method sends handleSignal: which is also 
>>>polymorphically defined under UndefinedObject and from there the 
>>>defaultAction message is sent to the MessageNotUnderstood exception 
>>>and reachedDefaultHandler is set to true, but:
>>>5. as the exception is also an Error instance it also executes 
>>>Error's defaultAction and signals UnhandledError and the search for 
>>>the handler starts over ;)
>>>6. if no handler is found on the current exection stack - this time 
>>>for the UnhandledError , the search ends with nil again and the 
>>>defaultAction message is sent to the exception - which for this 
>>>exception opens the Debugger
>>>
>>>
>>>This should roughly cover the process...
>>>
>>>best,
>>>Jaromir
>>>>
>>>>
>>>>--
>>>>R. Mark Volkmann
>>>>Object Computing, Inc.
>>
>>
>>--
>>R. Mark Volkmann
>>Object Computing, Inc.
>
>
>--
>R. Mark Volkmann
>Object Computing, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20240701/e5e635db/attachment.htm>


More information about the Cuis-dev mailing list