"Yukihiro Matsumoto" <matz / ruby-lang.org> wrote in
.....
> I'm totally against Python's in-place (argumented) assignment.  The
> operator "+=" and such work pretty differently depending on whether an
> operand is mutable or not.  I feel it's too dangerous and the source
> of confusion.  It's OK to make something mutable, but it should
> certainly not any sort of assignment.

I imagine that seasoned pythoneers are fairly sensitized about
(im)mutability issues so it might not be so dangerous after all?

>
> |It has become some ride of passage for Nubies seeing the light after
> |coming to terms with the loss of C++'s beloved post-fix ++-operator,
> |therefore it seems worthwhile pointing out that the exact same
> |theoretical arguments justifying the immutability of numbers apply
> |equally well to arrays and strings in fact most of Ruby's standard
> |objects. The proposed sacrifice of Ruby's numerical efficiency on the
> |altar of OO-purity (never mind I know I am execrating ;-) by policing
> |all mutability loop holes is taking things too far imho.
>
> It's not for OO-purity.  It's for consisntency of the number system.

Is consistency always such a good guideline??? Consistency
considerations brought us the dubious definition of  #<=> ,<, etc.
(and some sense much worse #==) methods for Complex numbers.
Immutability makes sense for Fixnum, mostly because they are
immediate values  and it is consistent with neutering Numerics dup
and clone  (of course we can always write ``x+ 0'' by the way)  but
enforcing it even for user defined Numeric classes (that was my
interpretation at least? - hope I am wrong) seems unnecessary
to me.

In the long run it might be a good idea to modularize the unrelated
behavior of the Numeric class into Modules  ( Immutable, Comparable
Ring, Euclidian, Metric, whatever )  to take away some of the
consistency pressure.

> And if you really want number efficiency, you can try NArray etc.

Yes this is a nice package for what it does (of course I like the Algebra
package much better;-) - in fact I actually much prefer NArray's add!,
sum! etc. over  C++-ish ``in place'' assignment operators.

/Christoph