[Date Prev] [Date Next] [Thread Prev] [Thread Next] Indexes: Main | Date | Thread | Author

Re: [ba-unrev-talk] Humble pie in academia

On Tuesday, October 15, 2002, at 11:34 AM, Eric Armstrong wrote:
> On the other hand, they implemented Perl's default $_ variable,
> which takes values and acts as a parameter automatically.
> Personally, I find that unfortunate. It means that programs will
> only be understandable by those who are familiar with that
> particular piece of magic. (I know it has made many a Perl
> program difficult for me to read.)    (01)

That's in there to enable quickie one liners and to keep the Perl 
people happy, but it's heavily discouraged.    (02)

Nothing in Ruby isn't an object, so there's standard OO constructs for 
all the magic globals. STDIN.readline is the equivalent of $_, but it's 
cooler to use an iterator on STDIN, eg:    (03)

   STDIN.each {|line| puts line }    (04)

The Object class contains selected commands from various classes to 
achieve it's procedural friendliness. Eg, puts is from the IO class, 
but you don't have to know about classes to use it.    (05)

   spwhite@chariot.net.au    (06)