From: Charles Oliver Nutter Date: 2007-07-13T17:10:55+09:00 Subject: Re: Proposal: runtime-modifying Kernel methods should be keywords Nobuyoshi Nakada wrote: > Hi, > > At Fri, 13 Jul 2007 16:09:40 +0900, > Nobuyoshi Nakada wrote in [ruby-core:11650]: >> gsub sets $_ in the caller's scope. > > Sorry, it sets $~, the methods set $_ are IO's methods, #each, > #gets and so on. Evan made a good point on IRC...perhaps both $_ and $~ should be treated as keywords and parse to specific nodes, like $0, $1, etc do. Anything that can be statically observed ahead of time works just as well to "fall back" on classic behavior, and if we could detect $_ and $~ that's just as good. (and FYI for those that don't know...the reason we can't detect them now is due to global var aliasing: alias $MY_NAME $~ ~/NetBeansProjects/jruby $ ruby -e "alias \$FOO \$1; 'foo'.gsub('o', 'a'); puts \$FOO" -e:1: can't make alias for the number variables alias $FOO $1; 'foo'.gsub('o', 'a'); puts $FOO ...which perhaps is a feature that should also be considered for removal, and we could just make the English.rb aliases official) - Charlie