From: Marcin 'Qrczak' Kowalczyk Date: 2002-12-13T06:39:21+09:00 Subject: Re: [YANQ] -yet another (ruby) newbie question -string#concat Mon, 9 Dec 2002 19:08:43 +0900, Gavin Sinclair pisze: > There's nothing really confusing about objects being modified. > All data can be modified, so why not the data in objects? I think > you need to treat your symptoms like a fear of spiders: confront > your fear, modify every object in sight until you are used to it ;) > (just kidding, of course) Well, functional programming is a paradigm that avoids modifying objects, and it produces readable and concise programs. There is nothing strange in treating data as immutable :-) You can program in more functional style in Ruby if you wish. It's great that it also provides those non-! methods. The style can be mixed - some people prefer to modify more, some less. Ruby doesn't has that much library support for immutable data as typical functional languages though - there are no Lisp-style lists or functional dictionaries for example. String is the primary type which usually makes sense to avoid modifying, even if you can. You can create a new string locally in a function and incrementally build it, but better avoid functions which modify their arguments. -- __("< Marcin Kowalczyk \__/ qrczak@knm.org.pl ^^ http://qrnik.knm.org.pl/~qrczak/