From: "Hal E. Fulton" Date: 2003-06-08T11:06:28+09:00 Subject: Re: case of sub! not working ----- Original Message ----- From: "David Garamond" To: "ruby-talk ML" Sent: Saturday, June 07, 2003 8:53 PM Subject: Re: case of sub! not working > Yukihiro Matsumoto wrote: > > |how about making the interpreter running a $ENV.freeze at the beginning of > > |the program? > > > > Do you mean freezing strings from ENV? Hmm, maybe. > > don't take this seriously... > > what if ENV's []= doesn't return strings, but string-like objects (or > instances of some subclass of String) that has a custom sub! (and all > other MODIFY! methods) containing setenv? > > perhaps that could complete the hash-like illusion of ENV? :-) Someone posted a solution like this and it got me to thinking... The problem is: What if you do this: str = ENV['foo'] and then 100 lines farther down, you do: str.gsub!(/this/,"that") It's not obvious that this statement is going to change the environment. So I think this is a bad idea in general. Cheers, Hal