<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<meta content="text/html; charset=UTF-8">
<style type="text/css" style="">
<!--
p
        {margin-top:0;
        margin-bottom:0}
-->
</style>
<div dir="ltr">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Helvetica,sans-serif">
<p>Hi Jaromir,</p>
<p><br>
</p>
<p>> <span>#release confused me - also a very general name and I haven't realized the naming issue.</span></p>
<p><span><br>
</span></p>
<p><span>#release is a base method of Squeak's dependency management - see Object >> #release and inheritance. :-)</span></p>
<p><span><br>
</span></p>
<p><span>Best,</span></p>
<p><span>Christoph</span></p>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>Von:</b> mail@jaromir.net <mail@jaromir.net><br>
<b>Gesendet:</b> Freitag, 17. Dezember 2021 22:00:42<br>
<b>An:</b> squeak-dev@lists.squeakfoundation.org; Thiede, Christoph<br>
<b>Betreff:</b> Re: Repeating pattern in system code: "process ifNotNil: [process terminate]"</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">Hi Christoph,<br>
<br>
thanks a lot!<br>
<br>
> The problem with your proposed refactoring would be that UndefinedObject is not a domain-specific null object but rather a general-purpose class for a language concern, and that overloading it with definitions from multiple domains would a) make it very chaotic
 and b) earlier or later lead to naming clashes between multiple domains.<br>
<br>
Aah, yes, indeed; naming clashes... and unexpected side-effects for other classes...
<br>
<br>
#release confused me - also a very general name and I haven't realized the naming issue. There's a pattern in these liquidating procedures - they terminate, destroy, release etc. and as if they suspected someone may have done it already :)<br>
<br>
Very helpful, thank you,<br>
best,<br>
<br>
~~~<br>
^[^    Jaromir<br>
<br>
Sent from Squeak Inbox Talk<br>
<br>
On 2021-12-17T19:44:52+00:00, christoph.thiede@student.hpi.uni-potsdam.de wrote:<br>
<br>
> Hi Jaromir,<br>
> <br>
> <br>
> you're basically describing the Null Object pattern [1]. You can find some other implementations of this pattern by browsing for classes whose name starts with "Null" (I think that NullCanvas and NullMutex serve as the best examples). The problem with your
 proposed refactoring would be that UndefinedObject is not a domain-specific null object but rather a general-purpose class for a language concern, and that overloading it with definitions from multiple domains would a) make it very chaotic and b) earlier or
 later lead to naming clashes between multiple domains. Imagine a different domain came up with some kind of Resource class that understands #terminate to and wanted to apply the same pattern. Depending on the intended behavior for both "null implementations"
 (such as: do nothing, show an error, forward the request to a singleton), you suddenly have a problem!<br>
> <br>
> <br>
> IMHO our current protocol on UndefinedObject is already too overcrowded and we should eliminate the "bottom context" protocol (#handleSignal: and #canHandleSignal:) in the long term by using #ifNil:ifNotNil: in their senders instead. Same for the "class hierarchy"
 protocol which should be obsolete since we have ProtoObject as a null object for "almost empty classes" (but I did not check this).<br>
> <br>
> <br>
> To summarize, I think that every domain which is in the need of a null object should either come with its own implementation or at least only add unique selectors to UndefinedObject (which would be the case for #handleSignal: & Co.). However, #terminate is
 not even an exclusive part of the domain-specific vocabulary for processes. However, this is only my own impression and I'm looking forward to corrections. Thank you for the interesting question!<br>
> <br>
> <br>
> Best,<br>
> <br>
> Christoph<br>
> <br>
> <br>
> PS: Also check out Object >> #handles: which looks even worse and maybe really should be pushed down to UndefinedObject. :-)<br>
> <br>
> <br>
> [1] <a href="https://refactoring.guru/introduce-null-object">https://refactoring.guru/introduce-null-object</a><br>
> <br>
> ________________________________<br>
> Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von mail at jaromir.net <mail at jaromir.net><br>
> Gesendet: Freitag, 17. Dezember 2021 20:14:06<br>
> An: squeak-dev at lists.squeakfoundation.org<br>
> Betreff: [squeak-dev] Repeating pattern in system code: "process ifNotNil: [process terminate]"<br>
> <br>
> Hi all,<br>
> <br>
> I have noticed this recurring theme in many system methods:<br>
> <br>
>         process ifNotNil: [process terminate]<br>
> <br>
> Correct me if I'm wrong but it looks to me as an ugly non-OO pattern which could be elegantly replaced with a simple:<br>
> <br>
>         process terminate<br>
> <br>
> if we implemented:<br>
> <br>
> UndefinedObject >> #terminate<br>
>         "return nil"<br>
> <br>
> Is this right or am I missing something?<br>
> Thanks,<br>
> <br>
> ~~~<br>
> ^[^    Jaromir<br>
> <br>
> Sent from Squeak Inbox Talk<br>
> <br>
> -------------- next part --------------<br>
> An HTML attachment was scrubbed...<br>
> URL: <<a href="http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20211217/8baae044/attachment.html">http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20211217/8baae044/attachment.html</a>><br>
> <br>
> <br>
</div>
</span></font>
</body>
</html>