The default behavior is to rely on ^self size = 0. But default size is doing too much (it iterates over all elements). It's OK for most of our classes which know very well about their size and override #size. It's not OK for an eventually lazy or infinite subclass. I realized this by answering http://stackoverflow.com/questions/40149826/is-there-a-construct-like-iterat...
Nicolas,
On Thu, Oct 20, 2016 at 9:40 AM, Nicolas Cellier < nicolas.cellier.aka.nice@gmail.com> wrote:
The default behavior is to rely on ^self size = 0. But default size is doing too much (it iterates over all elements). It's OK for most of our classes which know very well about their size and override #size. It's not OK for an eventually lazy or infinite subclass.
Good catch. Change it!
isEmpty self do: [:element| ^false]. ^true
I realized this by answering http://stackoverflow.com/ questions/40149826/is-there-a-construct-like-iterate- iterable-if-it-has-elements-else
_,,,^..^,,,_ best, Eliot
squeak-dev@lists.squeakfoundation.org