<div dir="ltr">When would you use it?<div><br></div><div>Two scenarios in which this might get used: 1. I expect a variable to contain a collection or nil (signifying that there is nothing to be enumerated); 2. I expect "any" kind of object to arrive in that variable.</div><div><br></div><div>If my expectation in scenario 1 is not met due to a programming error, I would have previously noticed it early because of the ensuing MessageNotUnderstood: isEmptyOrNil. Not any more with this addition. Instead I will just get MessageNotUnderstood: do:, for example, when I try to use this non-Collection like a Collection. This might happen at a much later time if the object gets stored somewhere due to "not being empty".</div><div><br></div><div>In scenario 2, what do I learn about my object if this answers false? That it is not nil and not an empty collection; there is still nothing that I can safely send to this kind of object except messages understood by all objects. To send the latter, I wouldn't have needed to run this test first. If the object is in fact empty or nil, I probably wouldn't keep it or send any further messages to it either because there is nothing in it.</div><div><br></div><div>Hence I'm wondering when this would ever be a useful response by a non-Collection. And whether it is worth hiding or delaying some errors, as explained above.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Am Do., 15. Aug. 2019 um 00:11 Uhr schrieb <<a href="mailto:commits@source.squeak.org" target="_blank">commits@source.squeak.org</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">A new version of Kernel was added to project The Inbox:<br>
<a href="http://source.squeak.org/inbox/Kernel-ct.1258.mcz" rel="noreferrer" target="_blank">http://source.squeak.org/inbox/Kernel-ct.1258.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: Kernel-ct.1258<br>
Author: ct<br>
Time: 15 August 2019, 12:11:10.7644 am<br>
UUID: fbc76d48-44ce-1c40-91f2-2c73171c7981<br>
Ancestors: Kernel-mt.1257<br>
<br>
[Proposal] Implement #isEmptyOrNil on Object<br>
<br>
Allows extended polymorphy.<br>
<br>
=============== Diff against Kernel-mt.1257 ===============<br>
<br>
Item was added:<br>
+ ----- Method: Object>>isEmptyOrNil (in category 'testing') -----<br>
+ isEmptyOrNil<br>
+ <br>
+       ^ false!<br>
<br>
<br>
</blockquote></div>