[squeak-dev] The defaullt implementation of isEmpty might do too much work

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Thu Oct 20 16:40:26 UTC 2016


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-iterate-iterable-if-it-has-elements-else
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20161020/c46e8b3c/attachment.htm


More information about the Squeak-dev mailing list