From: William Djaja Tjokroaminata Date: 2002-10-24T07:41:44+09:00 Subject: Re: Things That Newcomers to Ruby Should Know (10/16/02) Hi, Actually Ruby still gives you a choice. When you have a = AnObject.new b = a If you don't want side effects, you simply type b += anotherObj and if you want side effects, you may type b << anotherObj # if the '<<' operator is defined for AnObject So basically, in Ruby by default there are no side effects through '+=' (I guess to be safer, if not natural). Some methods (like '<<' and those ending in '!') usually modify the original object directly, and these methods create side effects. And the beauty of Ruby is, in my opinion, you can create your own methods or modify existing ones to have side effects. So I think you still have a lot of freedom in Ruby; but by default, Ruby directs you to the "safer" way :) . Regards, Bill P.S. In C++ terms, Ruby never overloads the assignment operator, Ruby by default does not provide copy constructors, Ruby always overloads the '+=' operator simply in direct connection to the corresponding '+' method, and Ruby allows you to overload many other methods that may look like operator (such as '<<'). =========================================================================== "Mills Thomas (app1tam)" wrote: > Actually, the way you describe '+=' makes sense to me. It is what I would > have expected. If I'm refering to one object in two different ways (that > is, two different variables), why not have side-effects? That doesn't seem > so very odd. Granted I've been doing OO stuff for about 17 years, but > still, it's not like it took that long to grok objects and references. > Drew