[squeak-dev] The Inbox: Tools-lrnp.1140.mcz

Marcel Taeumel marcel.taeumel at hpi.de
Mon Mar 14 11:59:33 UTC 2022


Hi Lauren --

This will raise a debugger:
   PackageOrganizer default packageOfSystemCategory: nil


This will not raise a debugger:
   PackageOrganizer default packageOfSystemCategory: nil ifNone: nil


> and noticed PackageInfo handles the nil system category as never yourself

I don't understand what you mean here. :-/

>That discovered, I still think putting a short circuit return in
> PackageOrganizer makes sense. If nil means 'not me', why spend time

> enumerating? 

Well, you suggest a typical "ifNil"-check. The contract in #packageOfSystemCategory:ifNone: is that only valid system categories are used as the "aSystemCategory" argument. Providing 'nil' is not a valid system category. Now, anything can happen. Usually, we rely on the fact that it is not possible to have package with a nil name.

If we would not rely on this contract, we would start to sprinkle "ifNil" checks all over the place. That's not a good style. It produces code that is difficult to maintain because nil has no specific domain.

Best,
Marcel
Am 14.03.2022 08:43:16 schrieb Lauren Pullen <drurowin at gmail.com>:
Hi Marcel,

On 3/11/22 08:19, Marcel Taeumel wrote:
> Considering the patch you proposed via PackageInfo-Base-lrnp.76, I think that you package organizer contains an invalid package 'nil'.
>
> Would you check that via "PackageOrganizer default packages"?
> Can you remember how you got into that state?
>
> It's unusual that the package organizer has a 'nil' package in its registry. Therefore, I would rather not start to patch the system with such extra "ifNil"-checks.
I checked a fresh trunk image, no nils in the package organizer.

I was looking at the debugger for it again and noticed PackageInfo
handles the nil system category as never yourself... it's the subclass
MCMockPackageInfo that doesn't do the nil check.

That discovered, I still think putting a short circuit return in
PackageOrganizer makes sense. If nil means 'not me', why spend time
enumerating?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20220314/5280aa74/attachment.html>


More information about the Squeak-dev mailing list