#flatten (Re: [squeak-dev] The Inbox: Collections-fbs.489.mcz)

Frank Shearar frank.shearar at gmail.com
Mon Aug 20 21:21:01 UTC 2012


On 20 August 2012 22:18, Colin Putney <colin at wiresong.com> wrote:
>
>
> On Mon, Aug 20, 2012 at 2:14 PM, Frank Shearar <frank.shearar at gmail.com>
> wrote:
>
>> OK. I didn't mean to suggest that #flatten was useful only for Arrays.
>> They're just a convenient thing to use for examples: literal syntax. I
>> hadn't really thought of collections of Strings. I'm not sure why
>> double dispatch is particularly useful, unless you're thinking of
>> being able to flatten arbitrary objects - turning a Person into
>> {#name. 'Frank'}.
>
>
> Strings are collections of characters, so Levente's example of #('foo'
> ('bar')) flatten would give you #($f $o $o $b $a $r). That's probably not
> what you wanted. Double-dispatch lets String opt out of flattening, so you'd
> get $('foo' 'bar').

Right. Mainly my brain stopped working when I tried to imagine a
String that contained a String. That, clearly, doesn't make much
sense.

frank

> Colin
>
>
>
>
>


More information about the Squeak-dev mailing list