From: "Hal E. Fulton" Date: 2003-06-28T02:30:39+09:00 Subject: Re: why can't I use $3somevar for global variable in ruby 1.8.0? ----- Original Message ----- From: "Robert Klemme" Newsgroups: comp.lang.ruby To: "ruby-talk ML" Sent: Friday, June 27, 2003 3:03 AM Subject: Re: why can't I use $3somevar for global variable in ruby 1.8.0? > > "WATANABE Hirofumi" schrieb im Newsbeitrag > news:4518-Fri27Jun2003134257+0900-eban@os.rim.or.jp... > > Hi, > > > > Donglai Gong writes: > > > > > > > There must be a reason why $1ve is disallowed in 1.8.0 but I can't > > > imagine why. Anyone knows the reason behind this change? > > In most programming languages identifiers may not start with a digit. > Same for Ruby. You can't do class 3Foo; end either. Simply get used to > not start identifiers with numbers. The change just makes identifiers for > global variables consistent with other identifiers. But $3var doesn't start with a 3; it starts with a $. This is historical Ruby behavior, but it seems to be changing; I now see that @3var is also disallowed. (I don't *think* it was in the past.) > In Ruby there's the additional point that $1, $2 etc. are used for holding > the contents of regexp sub pattern matches. This is probably related to the change. I don't read ruby-core, so I can't say for sure. Hal -- Hal Fulton hal9000@hypermetrics.com