bert at impara.de
Tue Nov 15 11:56:29 UTC 2005
Am 15.11.2005 um 12:20 schrieb Dan Corneanu:
> In a SqueakImage 3.8 running on WinXP the ALT+. does interrupt the
> (for me).
> I still have a question: why does Collection>>size iterates over all
> elements and actually counts them?
> 1. Why is this not implemented with a simple instance variable? or
It is, in subclasses where this matters (e.g., Set). Actually, almost
all subclasses override #size.
> 2. Why is this not implemented with subclass responsibility?
It's the default implementation because so you only have to override
#do: in a collection subclass. This default implementation is used,
for example, in LinkedList.
- Bert -
More information about the Squeak-dev