From: William Djaja Tjokroaminata Date: 2002-10-24T11:22:08+09:00 Subject: Re: Things That Newcomers to Ruby Should Know (10/16/02) Hal E. Fulton wrote: > Right now it's simple and regular, and unless > you're counting milliseconds you don't care > that an intermediate object is created. Hi Hal, In my opinion, for any "reasonable" programmer, it is usually not the milliseconds that causes concerns, but probably when the object is large and/or complex. In that case then I think usually we tell them that Ruby provides many methods that can modify the original object directly, without the need of intermediate object (but of course we also warn them about the aliasing/side-effects). If a person has a C++ background, then probably the concept of creation of intermediate object is troubling, because one of the many advices in C++ books is something like: "When you pass an argument to a function, in general it is better to pass it by reference instead of pass by value, because pass by value can be much more expensive as it may involve the creation of an intermediate object, while pass by reference will not." (To avoid modifying the original object then the "const" type specifier is used.) Therefore, a person with a C++ background, who is used to avoiding the creation of unnecessary intermediate objects, will be surprised that Ruby does it *all the time* in its '+=' operator. (Furthermore, the creation of equivalent intermediate objects may even be more "expensive" in Ruby than in C++ in absolute terms.) Therefore, this type of question is, in my opinion, usually not originated by practicality concern as much as caused by the differences in "school of thoughts" in the programming world. C++ is more about (computer's) performance, while Ruby is more about (programmer's) fun. :) Regards, Bill