From: Alan Chen Date: 2002-11-09T13:15:49+09:00 Subject: Re: Lighting Rod On Sat, Nov 09, 2002 at 11:47:28AM +0900, Yohanes Santoso wrote: > "Hal E. Fulton" writes: > > > ----- Original Message ----- > > From: "Yohanes Santoso" > > To: "ruby-talk ML" > > Sent: Friday, November 08, 2002 7:49 PM > > Subject: Re: Lighting Rod > > > > > > > > 1) Why magic variables? > > > > > > Um... beneficial crufts? I think because they are already idioms. > > > I don't even know the other name for $? (check return status). > > > > They're only idioms if you're used to Perl. > > or shell scripting. But you're right, a ruby user shouldn't be expected to > have prior perl or shell scripting knowledge. Then, the only people > benefited by magic variables are people like me who are too lazy to > look up the proper name for $? :) (Ok... I'm looking it up now, I'm > also curious as to what it is called). > > YS. That and the alternatives to some are a little more verbose. I'm thinking of the Regex match variables $1, $2, etc... Now I'm curious, how many people use this: if( str =~ /pattern/) # .. do stuff with $1, $2, et al.. versus this: if( m = /pattern/.match(str) ) # do stuff with match obj. m -- Alan Chen Digikata LLC http://digikata.com