I was browsing some of the Magritte source code, when I saw a message
that confused me:
        selectors := anObject class allSelectors
                select: #isDescriptionSelector.

I couldn't understand how you could pass a Symbol to #select: instead
of a block -- certainly the definition of Collection>>select: implies
it should only take a block. But trying it for myself, I see it works
-- eg
{ 1. 2. 3. 4. } select: #even.

can be used in place of:

{ 1. 2. 3. 4. } select: [ :each | each even ]

Given how much simpler this looks, I was surprised I'd not seen this
usage before, and searching for senders of #select: shows that the
wordier version seems to be generally preferred.

So my question is: is this a usage I should adopt or avoid?

Cheers,
Michael
_______________________________________________
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners

Reply via email to