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

Colin Putney colin at wiresong.com
Mon Aug 20 21:18:36 UTC 2012


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').

Colin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20120820/56764b1a/attachment.htm


More information about the Squeak-dev mailing list