<html><body bgcolor="#FFFFFF"><div>"...</div><span class="Apple-style-span" style="font-size: 13px; -webkit-tap-highlight-color: rgba(26, 26, 26, 0.296875); -webkit-composition-fill-color: rgba(175, 192, 227, 0.230469); -webkit-composition-frame-color: rgba(77, 128, 180, 0.230469); ">My first thought on reading the code was "Why the heck is he passing around arrays like that? Make it an object!"</span><div>..."</div><div><br></div><div>That's exactly what happened to me too, when reading the code. &nbsp;In fact I started to (in my head) redesign the class method on the reciebet to just process a new object capturing this behavior.<br><br>- Steve</div><div><br>On Dec 26, 2009, at 10:08 AM, Colin Putney &lt;<a href="mailto:cputney@wiresong.ca">cputney@wiresong.ca</a>&gt; wrote:<br><br></div><div></div><blockquote type="cite"><div><span></span><br><span>On 2009-12-26, at 3:20 AM, Bert Freudenberg wrote:</span><br><span></span><br><blockquote type="cite"><span>... however, #in: only works with single-argument blocks. Making #in: work with multi-arg blocks is of course possible but feels not right either. Does anybody have an idea for a better selector? Or another idea for how to code &nbsp;this? </span><br></blockquote><span></span><br><span>I've occasionally mused that #do: and #in: ought to be the inverse of each other. Object&gt;&gt;do: would behave like #in: and Collection&gt;&gt;in: would evaluate the block with 'self anyOne' as the parameter. With multi-arg blocks it could supply more elements, as in your third example. On UndefinedObject, both methods would do nothing. This would probably break a lot of code, so it's not really feasible now, but if I could think of some other selectors that made sense...</span><br><span></span><br><span>Your idea here strikes me as similar to Ruby's splat operator, or the way functional languages deal with lists by recursively splitting them into head and tail. It feels like a really useful idiom, and it would be nice to have it in Smalltalk, the same way we have #ifTrue:ifFalse: rather than actual syntax for booleans.</span><br><span></span><br><blockquote type="cite"><span>In my example, "#getChannels" is an external library call returning an array, this is the code that converts the raw result into a proper object structure. You can argue that low-level code like this is okay to look like (2) but I'd say it doesn't have to ;)</span><br></blockquote><span></span><br><span></span><br><span>My first thought on reading the code was "Why the heck is he passing around arrays like that? Make it an object!" Preaching to the choir, I guess. :-)</span><br><span></span><br><span>Colin</span><br><span></span><br><span></span><br></div></blockquote></body></html>