From: "Ara.T.Howard" Date: 2005-06-03T01:56:32+09:00 Subject: Re: how to create a variable with eval - solved! [WAS] Re: binding, ObjectSpace._id2ref [WAS] Re: [ANN] parseargs-0.0.0 On Fri, 3 Jun 2005, Pit Capitain wrote: > Ara.T.Howard schrieb: >> wow! it __can__ be done. now someone try to break it please! ;-) > > Ask and thou shalt receive: > >> (previous code) > > def a; "ouch"; end > >> set_var 'a', 42 >> p a > > You get a name clash between methods and local variables. Otherwise, your > code should work fine, AFAIKT. hmm. i guess here def a; 'forty-two'; end set_var 'a', 42 p a we get the method. and here def a; 'forty-two'; end a = 42 p a we get the local_variable. so in either case you get a name clash - but the sense of it is reversed with set_var. i wonder if this is un-intuitive enough to render it useless? cheers. -a -- =============================================================================== | email :: ara [dot] t [dot] howard [at] noaa [dot] gov | phone :: 303.497.6469 | My religion is very simple. My religion is kindness. | --Tenzin Gyatso ===============================================================================