[squeak-dev] Re: Future of Squeak, and outsider's view
Klaus D. Witzel
klaus.witzel at cobss.com
Tue Jun 30 05:22:16 UTC 2009
On Tue, 30 Jun 2009 07:15:37 +0200, Igor Stasenko wrote:
> Since multiple people seem don't grok my example, let me simplify it a
> bit:
>
> Suppose you have a special collection of objects over which you can
> iterate.
>
> The items in that collection could be anything - you don't really care
> on almost any of them, except those ones which is also a special
> collections of same kind as a container.
>
> so, then you could have a method, which by iterating through your
> special collection, ignores all objects except those who
> also can be iterated in same manner:
>
> MySpecialCollection>>mySpecialCollect: aBlock
> ^ self collect: [:each |
> each isMySpecialCollection ifTrue: [ each mySpecialCollect:
> aBlock] ifFalse: [each]
> ]
In _any_ Smalltalk, (each respondsTo: #mySpecialCollect:) is what you want.
>
--
"If at first, the idea is not absurd, then there is no hope for it".
Albert Einstein
More information about the Squeak-dev
mailing list
|