[squeak-dev] Installing metacello within a 'Smalltalk run:[]' fails

Levente Uzonyi leves at caesar.elte.hu
Thu Jul 16 12:50:15 UTC 2020


On Wed, 15 Jul 2020, tim Rowledge wrote:

>
>
>> On 2020-07-15, at 7:09 PM, Levente Uzonyi <leves at caesar.elte.hu> wrote:
>> 
>> On Wed, 15 Jul 2020, tim Rowledge wrote:
>> 
>>> Running Installer ensureRecentMetacello works. (in a 5.3-19435 image)
>>> 
>>> Wrapping it in Smalltalk run:[Installer ensureRecentMetacello ]
>>> crashes. Specifically in MetacelloScriptEngine>>#lookupProjectSpecFor: we find that 'registration' is nil on the last line. 
>>> Seems a bit odd; possibly sometihng to do with the assorted exception handling in the SmalltalkImage>run: code?
>> 
>> I think the cause of the problem is that SmalltalkImage >> #run: catches all Notifications, logs them, and finally #resumes them.
>> But many Notifications override #defaultAction, and the return value of that method will be the value the Notification normally returns with when not handled.
>> #resume does not send #defaultAction (it sends #defaultResumeValue, which is rarely used).
>
> Sounds pretty likely to me. It's another of those 'fun' cases where one tries to handle errors that you don't necessarily know how to handle. Almost always a problem. I think I have a sigline about that mistake.
>
>
>> 
>> IMO the code should not #resume the Notifications just #pass them, so that they can return with whatever they want (or be handled by an outer handler).
>
> Except that surely the problem then becomes that the default action of many Notification type exceptions is to do some UI thing, and the entire point of the run: stuff is to avoid that so it can be a commandline no-UI activity. ;-)

AFAIK that is why DummyUIManager exists. It lets you provide answers to 
these questions (via Notifications :)) or go with a default value if 
possible.


Levente

>
> Is it a case of a different type of exception being the right way of doing it within the metacello load code?  I see several Metacello exception classes under Notification, mostly with #defaultAction returning a boolean. Don't see any current exception class that really covers the 'give me a default boolean answer' case.
>
> Exception handling is *such* fun!
>
> tim
> --
> tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
> Useful Latin Phrases:- Ne auderis delere orbem rigidum meum! = Don't you dare erase my hard disk!


More information about the Squeak-dev mailing list