From: RK Sentinel Date: 2009-01-22T23:11:16+09:00 Subject: Re: String doesnt auto dup on modification Thanks for all the helpful replies. Its my first venture: a widget library. Here's an example: Sometimes a string is passed to a class, say, using its set_buffer method (which is an _optional_ method). set_buffer just assigns it to @buffer. But deep within the class this variable is being edited using insert() or slice!() (and this IS necessary) since the widget is an editing widget. So its not so clear when i added set_buffer method that this would happen. As and when i discover such bugs in my code, I start adding dup(), and yes sometimes these lines bomb when another datatype is passed (I had asked this in a thread recently: respond_to? dup was passing, but the dup was failing). Yesterday, I had written an Action class which can be used to create a menuitem or a button. The string used in the Action constructor can be like "&Delete". Button and Menuitem remove the "&" using a slice!(). And i was wondering why the second usage was failing to find the "&". Anyway, i realize its more my incompetence, and i must be careful with destructive methods, but I just thought maybe there's some other way to do this, so i am not leaving it to my memory. Thanks again for the helpful replies. The ruby community really rocks when it comes helping others. -- Posted via http://www.ruby-forum.com/.