[squeak-dev] terse Object concatenation

Chris Muller asqueaker at gmail.com
Mon Sep 20 17:24:32 UTC 2010


Hello,

> i believe that this is not possible to do in a consistent manner,
> because:
> string , string means string concatenation
> object , object means collection creation

First, let me clarify that standard String concatenation is
unaffected, of course.  Nothing about this enhancement has any affect
on any legacy code.

But to address your argument about consistency, String is already
unique and pervasive, with other of its own idiosyncracies that are
"inconsistent" with other kinds of objects.  For example, consider
String>>#= vs. Object>>#=.  Even String>>#= vs. ByteArray>#=.  Very,
very different, and "not obvious" what String>#= should do without
looking at the implementation.

> so it is not obvious (to me at least) what
> string , object
> object , string
> should actually do.

It is based on the receiver of the message.  Like the way you get
different results from:

   { 1. 2. 3} difference: { 2. 3 }.
   { 2. 3} difference: { 1. 2. 3 }

depending on which is the receiver...

> and then there's the fact that strings are
> collections too, so
> string , $c
> $c , string
> have yet another set of possible meanings.

This is the same meaning as above.  The Character is the "object" and
the receiver determines what happens..

Hope this helps,
  Chris



More information about the Squeak-dev mailing list