From: Eric Mahurin Date: 2005-10-15T05:14:07+09:00 Subject: Re: Wilderness: Need Code to invoke ELTS_SHARED response --- "Charles E. Thornton" wrote: > Mauricio Fern�ndez wrote: > > >On Fri, Oct 14, 2005 at 05:04:59PM +0900, Charles E. > Thornton wrote: > > > > > >>Testing the My Object Dump and I am trying to cause > creation > >>of a shared string object (ELTS_SHARED...) > >> > >>I tried: > >>#!/usr/bin/ruby > >># > >># Trace Execution > >># > >>#set_trace_func proc { |event, file, line, id, binding, > classname| > >># printf "%8s %s:%-2d %10s %8s\n", event, file, line, id, > classname } > >># > >>v1 = "hello long message" > >>v2 = v1.sub(/([aeiou])/, '*') > >>p v2 > >> > >>But No Luck: > >> > >>Can someone provide a short fragment that induces this > behavior (Shared!). > >> > >> > > > > v1 = "foo".clear > > > > > > > Runinng 1.8.2 Produces > --------------------------------- > > v1 = "foo".clear #==> undefined method `clear' for "foo" > :String > > "clear" only works for HASH and ARRAY (oh yeah, SET and > QUEUE too)? I haven't looked at string.c, but if it is like array.c, you should be able to just grab a muli-element slice (#slice or #[]) of a string to start sharing. __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com