[squeak-dev] SystemNavigation >> #allMethodsSelect:localTo:
Eliot Miranda
eliot.miranda at gmail.com
Tue May 21 21:53:53 UTC 2013
On Tue, May 21, 2013 at 2:40 PM, Frank Shearar <frank.shearar at gmail.com>wrote:
> allMethodsSelect: aBlock localTo: aClass
> "Answer a SortedCollection of each methodr in, above, or below the
> given
> class that, when used as the argument to aBlock, gives a true result."
>
> | aSet |
> aSet := Set new.
> Cursor wait showWhile:
> [aClass theNonMetaClass withAllSuperAndSubclassesDoGently:
> [:class |
> class selectorsAndMethodsDo:
> [:aSelector :aMethod|
> (aBlock value: aMethod) ifTrue:
> [aSet add: (MethodReference new
> setStandardClass: class methodSymbol: aSelector)]]].
> aClass theNonMetaClass class withAllSuperAndSubclassesDoGently:
> [:class |
> class selectorsAndMethodsDo:
> [:aSelector :aMethod|
> (aBlock value: aMethod) ifTrue:
> [aSet add: (MethodReference new
> setStandardClass: class methodSymbol: aSelector)]]]].
> ^aSet
>
> Um. That is just an accidental duplication of the aClass
> theNonMetaClass class withAllSuperAndSubclassesDoGently: block, right?
>
No, it's not :) It's preserving existing behavior, which is to search
class and instance side. Note that
aClass theNonMetaClass withAllSuperAndSubclassesDoGently:
[:class|
{class. class class} do: aBlock
is not equivalent to
aClass theNonMetaClass withAllSuperAndSubclassesDoGently: aBlock
aClass theNonMetaClass class withAllSuperAndSubclassesDoGently: aBlock
because the latter searches Behavior, ClassDescription, Class etc, while
the former doesn't.
> frank
>
>
--
best,
Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20130521/8b72b3ae/attachment.htm
More information about the Squeak-dev
mailing list
|