[squeak-dev] #in: for collections

Bert Freudenberg bert at freudenbergs.de
Sat Dec 26 17:48:34 UTC 2009


On 26.12.2009, at 17:27, Randal L. Schwartz wrote:
> 
>>>>>> "Bert" == Bert Freudenberg <bert at freudenbergs.de> writes:
> 
> Bert> ... however, #in: only works with single-argument blocks. Making #in:
> Bert> work with multi-arg blocks is of course possible but feels not right
> Bert> either. Does anybody have an idea for a better selector? Or another idea
> Bert> for how to code this?
> 
> paralleling "with:" vs "withAll:" and "add:" vs "addAll:", I'd vote
> for the slightly clumsy #allIn: or #inAll:
> 
> Collection >> #inAll: aBlock
>  aBlock #valueWithPossibleArgs: self
> 
> If #valueWithPossibleArgs: requires specifically an Array, there might
> need to be one definition for arrays, and another for Collections
> that call #asArray.

#allIn: reads quite okay I think (4):

	sharedActivity getChannels allIn: [:tpService :tpConn :tpChannels |
		tpChannels collect: [:channel |
			TelepathyChannel
				connection: tpConn dbusConnection
				busName: tpService
				objectPath: channel dbusPath]]

Not sure if it's useful enough that we want it though?

- Bert -





More information about the Squeak-dev mailing list