From: Charles Mills Date: 2005-01-14T05:21:17+09:00 Subject: Re: Mutable strings Mystifier wrote: > Hi All, > > Since my communications skills have be questioned on the ML, I am trying to > be better :) > > > I saw few last posts by matz categorically saying that strings shall be > mutable. > > I have nothing against or for it as a language specification. What interests > me that if string are immutable, we can use strings as symbols. This can > bring about few important effects on VM. > > 1) Symbols and FixNum have few exceptions to the usual rules. Symbols may > not have any exceptions, since symbol and strings will be basically same. Symbols are immutable. The current implementation of symbols seems like a good one to me. They are just a number that uniquely identifies a string (contained in a symbol table somewhere in the interpreter). > > 2) Efficiency of VM will improve because Symbols and Strings can be used > interchangeably. > Ruby already uses some nice tricks for sharing memory between string instances (and between array instances). > 3) It might help on security, perhaps. > > A Mutable string class can be created for mutating strings. > > No, I am not trying to create another java, but as Users, how many times > have you mutated your strings? Try ri String. About 1/2 the methods change the reciever. > > A mailing list to discuss Vuby Specifications has been created on Berlios > and will be active shortly for discussions. > > https://developer.berlios.de/projects/vuby/ > There are already a number of Ruby VM projects. Many of them relatively mature. Perhaps you should take a look at those. If you are writing a VM, I don't see why you would need to rewrite the standard library, or even break the Ruby API at the C level. -Charlie