From: Dennis Ranke Date: 2004-02-26T18:59:54+09:00 Subject: Re: Operators +, += and = in Ruby 2 On Wed, 25 Feb 2004 16:12:16 +0100, Robert Klemme wrote: > Now, wouldn't it be better to turn that around and have people define > operator += and automatically convert operator + like in: > > "x + y" becomes implicitely "x.dup += y" > > [...] > > What do others think? Did I overlook something? Yes, I think so. With your proposed change it would be impossible to express operations where the result has a different type than the first operand, like, for example: Float = Vector * Vector # (dot product) or Vector = Matrix * Vector So in some cases it is not possible to correctly define a *= operator, while a * operator is still desirable. Of course, it would be possible to automatically define a missing += using a defined +, and a missing + using a defined +=. Whether this would be a good idea is certainly debatable. -- exoticorn/farbrausch