From: "Kontra, Gergely" Date: 2002-10-19T00:42:20+09:00 Subject: Re: Things That Newcomers to Ruby Should Know (10/16/02) > 13. Ruby variables hold references to objects and the = operator > copies the references. Also, a self assignment such as a += b is > actually translated to a = a + b. Therefore it may be advisable to > be aware whether in a certain operation you are actually creating > a new object or modifying an existing one. > a. In Ruby the "self assignment operator" goes beyond "+=, -=, *=, > /=, %=". In particular, operators such as "||=" also exist (but > currently not for a class variable if it is not yet defined; this > may change in the future). Please see Table 18.4 in the > "Programming Ruby" book for the complete list. Also notice (performance tip), that string << "another" is much faster than string+="another" (no extra object creation) so you should use any class-defined update-method, if exists. Gergo +-[Kontra, Gergely @ Budapest University of Technology and Economics]-+ | Email: kgergely@mcl.hu, kgergely@turul.eet.bme.hu | | URL: turul.eet.bme.hu/~kgergely Mobile: (+36 20) 356 9656 | +-------"Olyan langesz vagyok, hogy poroltoval kellene jarnom!"-------+ . Magyar php mirror es magyar php dokumentacio: http://hu.php.net