On Wed, 2007-06-06 at 07:12 +0200, Paolo Bonzini wrote:
> Stephen's idea and my answer regarding #flatten: gave
me a weird idea.
> Adding
>
> Object >> do: aBlock [ aBlock value: self ]
>
> would be quite convenient in many cases where you have
double dispatch
> going on between normal objects and collections. How
weird would this be?
Very. I got a distinctly bad taste in my figurative mouth
when I saw it
in RBProgramNode.
I actually would rather that #flatten (or whatever it's
called) not
conflate non-collections with collections so that
#((1 2) 3) flatten
signals an error.
On the other hand, something like the CL utility seen in
some places
(defun mklist (obj)
(if (listp obj)
obj
(list obj)))
might be a good solution for those cases, since it makes it
absolutely
clear that the code wishes to conflate collections and
non-collections.
Something other than #asArray, of course
--
;;; Stephen Compall ** http://scompall.no
candysw.com/blog **
Failure to imagine vast possibilities usually stems from a
lack of
imagination, not a lack of possibility.
_______________________________________________
help-smalltalk mailing list
help-smalltalk gnu.org
http://lists.gnu.org/mailman/listinfo/help-smalltalk
|