From: "Enric Lafont" <enric / 1smart.com>


> Austin Ziegler wrote:
>
> >[ .... a lot of valid comments snipped ... ]
> >
> >Matz determined that String, Regex, Array, Files, and Hashes (among
> >other thigns) are necessary parts of the language. Given the sorts
> >of work that I've done with Ruby so far -- I agree.
> >
> >
> Ok, it was his decission, but Ruby will not lost a single bit of
> expressiveness if you delete the String class, becasue String is not
>  part of the language, it's part of the Ruby environment, you can write
> s String class (a less efficient one) with the Array class, same for
> hashes and Regex.

You need to actually do some work in Ruby before you're qualified to make
comments like this.

1. String *is* part of the language, not the environment.
2. "Ruby will not lose expressiveness if you delete String" == false.
Completely false.

> Ok, I was kidding. I don't want to enter a discussion on how much
> diferent ways to say one thing you need to be expressive. In human
> languages, when you have more than one way to say something you can need
> an interpreter (lawyer) to correctly decipher what it was intended to
> say, and in some cases, even a judge. Expressiveness is not ever a good
> thing

I don't want to sound (too much) like a python advocate, but we here, gathered
in this group, are not language academics, but Ruby users (with occasional
digressions).  If expressiveness is not ever a good thing, what exactly do you
like about Ruby, as opposed to ... say, machine language?

> >That's what coding standards are for, not programming language
> >designs.
> >
> There is a Ruby Standard I can follow ?

I suggest you form your own, however, there is information gathered on the Wiki
about it.

>
> >I don't see it as flexibility lost. I see it as "utterly stupid
> >behaviour" prevented. There is no legitimate reason for someone to
> >define a = a + b to be different from a += b.
> >
> You have decided that the semantic (meaning) of "a += b" is "a = a + b,
> and it's right in some contexts, but if  want to define a  new meaning
> to a +=b. I will need to use other language to express what "+=" means
> [...]

a += b is always, by definition, in any language, the same *behaviour* as a = a
+ b.  If you disagree, you are being absurd.  The only possible difference is
in efficiency: run-time hacks that save an intermediate object.  This is a
sometimes a valid concern, and there is a remedy: the << operator.

  a = a + b       (old object 'a' lost)
  a << b          (same behaviour, *possibly* more efficient)

This behaviour is defined for Strings and Arrays, probably Hashes and
definitely IOs, which probably has different semantics.  For other things,
you're welcome to define it.  There's nothing magical about "+=" - it's a
heritage-listed operator.  Learn and love "<<" instead.

Gavin