On 15.05.2007 15:54, Robert Dober wrote:
> On 5/15/07, Brian Candler <B.Candler / pobox.com> wrote:
> <snip>
>> But then what you want are not symbols, but true immutable strings. By 
>> that
>> I mean: some object where I can write 10MB of binary dump. If I want 
>> to add
>> one character to the end of it, then I create another object containing
>> 10MB+1byte of binary dump, and the old 10MB object is garbage-collected.
> But of course we have immutable strings already :)))
> 
> class IString < String
>   def initialize str
>     super(str)
>     freeze
>   end
> end

What advantages does this have over using "freeze" directly?

str = "foo".freeze

It seems using a new class will increase the likelihood of things to break.

> HTIOI (Hope this is of interest ;)

LOL

> You see things; and you say Why?
> But I dream things that never were; and I say Why not?
> -- George Bernard Shaw

Greetings to George, btw. :-)

	robert