On Monday, 24 October 2016, monty <monty2@programmer.net> wrote:
Why not just make #size a subclassResponsibility or add abstract superclasses for lazy or infinite collections that implement #isEmpty using #do: and change #size to shouldNotImplement?

Because #do: is the only method required to be overridden by Collection subclasses. All other methods are implemented in terms of #do:.

So yes, if your Collection subclass has an optimized implementation for #isEmpty, then provide it. That is a small price to pay for making a class work optimally across different code bases.

- Bert -