[squeak-dev] Faster FileStream experiments
Ralph Johnson
johnson at cs.uiuc.edu
Fri Nov 27 12:15:18 UTC 2009
> I think we need a common superclass for Streams and Collection named
> Iterable where #do: is abstract and #select:, #collect:, #reject:,
> #count:, #detect:, etc (and quiet a lot of the messages in enumerating
> category of Collection) are implemented based on #do:
>
> Of course Stream can refine the #select:/#reject methods to answer a
> FilteredStream that decorates the receiver and apply the filtering on
> the fly. In the same way #collect: can return a TransformedStream that
> decorates the receiver, etc.
Since Stream can't reuse #select: and #collect: (or #count, and
#detect: on an infinite stream is risky), they shouldn't be in the
superclass. In that case, what is its purpose?
i think it is fine to give Stream the same interface as Collection. I
do this, too. But they will share very little code, and so there is
no need to give them a common superclass.
-Ralph Johnson
More information about the Squeak-dev
mailing list
|