From: Robert Feldt Date: 2003-08-18T22:48:46+09:00 Subject: Re: Question: immutable strings as design goal? > |www.artima.com in which he criticized Ruby's mutable strings - saying > |that of such a horror he could ne'er conceive, or something :) > > If mutable strings are horror, mutable dictionaries should be as well. > The one with such standard should go to side-effect free language like > Haskell. ;-) > I agree that it sounds like a very ad hoc design decision. > I rarely have such problems caused by mutable strings. Besides, Ruby > is not a language to keep people away from horror. You can write > ugly, scary, or dangerous programs in Ruby, if you want. It's cost > for freedom. > This points to an important "philosophical" difference that stands out to me when comparing Ruby and Python: Python gives me the feeling of trying to be a "Language for the Masses" (LFM) and tries to put restrictions on what can be done. You need to format your code in a certain way, your strings (but only a minority of other objects) are immutable by default etc. As discussed on ll1-discuss mailing list and other places LFM's are in contrast to LFSP's (Language for Smart People / experts) that tries to give you as much power as possible. To me the LFM thinking is absurd and even inhumane since it (ironically enough) says that there is an elite that know the area well enough to decide what other people is allowed to use. To me matz goal seems to be for less of an LFM than Guidos. Then again I have too little experience with Python vs. Ruby to actually know. I also may be exaggerating since also matz has his limits (no macros in Ruby, no multi-methods etc) ;). Regards, Robert Feldt Ps. "Rough" Immutable strings in ruby: s1 = "a" s1[0] = ?b p s1 # => b def ims(string) string.freeze end s2 = ims "a" p s1 # => a s2[0] = ?b # => `[]=': can't modify frozen string (TypeError) ;)