[squeak-dev] The Inbox: Kernel-ct.1258.mcz

Jakob Reschke forums.jakob at resfarm.de
Thu Aug 15 00:51:57 UTC 2019


When would you use it?

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.

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".

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.

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.

Am Do., 15. Aug. 2019 um 00:11 Uhr schrieb <commits at source.squeak.org>:

> A new version of Kernel was added to project The Inbox:
> http://source.squeak.org/inbox/Kernel-ct.1258.mcz
>
> ==================== Summary ====================
>
> Name: Kernel-ct.1258
> Author: ct
> Time: 15 August 2019, 12:11:10.7644 am
> UUID: fbc76d48-44ce-1c40-91f2-2c73171c7981
> Ancestors: Kernel-mt.1257
>
> [Proposal] Implement #isEmptyOrNil on Object
>
> Allows extended polymorphy.
>
> =============== Diff against Kernel-mt.1257 ===============
>
> Item was added:
> + ----- Method: Object>>isEmptyOrNil (in category 'testing') -----
> + isEmptyOrNil
> +
> +       ^ false!
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20190815/4fde2a82/attachment.html>


More information about the Squeak-dev mailing list