Collection withAllSubclasses collect: #numberOfLinesOfCode
is the equicalent to
Collection withAllSubclasses collect: [:each | each numberOfLinesOfCode ]
What happens below is that (unary) symbols are polymorphic with one parameters blocks, i.e. they understand cull: and value:, which is implemented as:
value: anObject��
^anObject perform: self.
So in fact what will hapen is more like
Collection withAllSubclasses collect: [:each | each perform: #numberOfLinesOfCode ]
... which is a bit slower than the traditional block version so you might want to think if that makes a difference in your case.
You can use symbols whenever a unary block is expected, for example in most collection enumerating methods, such as do:, select:, reject:, allSatisfy:, detect:, ... (see 'enumerating' protocol in Collection class for more examples).
All this methods send value: (or maybe cull:) to the received block argument, so you can pass an unary symbol instead (or even whatever object that understands value:).