Phil,
I see your point but disagree.
I don't use Pharo regularly, so I cannot currently check if the
implementation around this emptiness check is complete.
With complete I mean that following your logic, theere should be
at least implementations of
ifEmpty:
ifNotEmpty:
ifEmpty:ifNotEmpty:
ifEmptyOrNil:
ifEmptyOrNil:otherwise:
I really have to check for the size of collections very often, and
the size of 1 is a very frequent case. So why not add:
ifExactlyOne:
ifSizeIs:do:
ifSizeIsGreaterThan:do:otherwiseDo:
You get the picture. I strongly believe this leads to pollution
and ends up in a mess.
We could save so much typing and make our programs so much more
readable if we only were a bit more creative, right? ;-)
A DSL is another story, though. If you write a Library that makes
handling Collections nicer, this is okay and the methods are good
to exist in its context. But they shouldn't necessarily all be
part of the base image.
Don't get me wrong: if you and the Pharo community agree on lots
of convenience methods, that is okay for me, and I find myself
adding such methods to VA Smalltalk from time to time. I
appreciate many of them being brought to VA ST in Grease.
Sometimes, this is simply a question of taste, sometimes it saves
typing, sometimes it helps to improve readability of code.
But I wouldn't go so far to tell people they should better use
such a method as a general advice. I would probably tell them:
"look, here's a method I find much more elegant, you could *also*
use that to save typing/increase readability".
Just my 2 cents, and highly off topic ;-)
Joachim
Am 01.11.16 um 08:43 schrieb
phil@highoctane.be: