[squeak-dev] terse Object concatenation

Chris Muller asqueaker at gmail.com
Wed Sep 22 16:14:08 UTC 2010


>> First, let me clarify that standard String concatenation is
>> unaffected, of course.  Nothing about this enhancement has any affect
>> on any legacy code.
>
> objection, your honor :)
> string concatenation fails if used with something else than
> strings. so your enhancements may cause to hide or change bugs.

No, I don't think so.

   'hello', Object new ---> "'helloan Object'"

   Object new, 'hello' ---> "{an Object . $h . $e . $l . $l . $o}"

Where is the "failure?"

If you notice the timestamp on the methods, you will see that we have
been using this for over five years.  We have not noticed anything
broken during that time.  So, won't you please back up your claim with
an example?

> yes, i understand what your enhancement does.
> it just that we disagree about whether it is beneficial
> to be able to use
> obj, obj
> instead of
> { obj. obj }

It is not "instead of" it is "in addition to".  It's use is optional.
You are not forced to use it.  However, I don't want to force my
non-technical users to have to write

  { column1. column2. column 3. }

instead of

  column1, column2, column3

For non-technical users, the latter _is_ beneficial because it is more
natural.  I'm not talking about them writing Smalltalk methods, I'm
talking about when they specify, for example, a list of columns in a
text-input field in the user-interface that the program to which I
apply Smalltalk interpretation (it's actually more sophisticated than
that, but for sake of simple explanation..).

> i happen to think the opposite (i.e. not beneficial)
> because it is not universal. i.e. it makes a difference
> string , object
> object , object

I'm not sure what you mean by "not universal".  That is like saying
you are opposed to overloading in general..??  This is consistent with
other overloads in that the receiver of the message determines the
behavior, just like in other methods (like Collection>>#difference:
which you did not address).  If an Object receives it, you get a
pointer-list of objects because the receiver is a pointer object.  If
a String receives it, you get a byte-list of characters because the
receiver is a byte object.  Isn't that completely consistent and
logical.

----

So far the arguments presented against this are:

  - "string concatenation fails if used with something else than strings"
  - "not beneficial"
  - "not universal"
  - "awkward and hackish"

I hope these are addressed these to your satisfaction.  If not, at
least you can opt out from using it and, in five years of using it,
has presented no ill-effects on any legacy code..

 - Chris



More information about the Squeak-dev mailing list