[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Question about getc

Yukihiro Matsumoto

6/5/2007 1:49:00 PM

Hi,

In message "Re: Question about getc"
on Tue, 5 Jun 2007 19:15:06 +0900, "Sun Park" <geniusleonid@gmail.com> writes:

|If we call gets(), the returned string is copied to a special variable $_
|Do we have such things for getc(), too?

No, implicit global variables are evil. I'd rather remove $_ in the
future.

matz.

4 Answers

James Gray

6/5/2007 2:07:00 PM

0

On Jun 5, 2007, at 8:55 AM, Sun Park wrote:

> I use global variables for golfing only.. :) but please don't
> remove $_!

This is probably a good argument for removing the variable. ;)

James Edward Gray II

Rick DeNatale

6/6/2007 3:32:00 AM

0

On 6/5/07, Yukihiro Matsumoto <matz@ruby-lang.org> wrote:
> Hi,
>
> In message "Re: Question about getc"
> on Tue, 5 Jun 2007 19:15:06 +0900, "Sun Park" <geniusleonid@gmail.com> writes:
>
> |If we call gets(), the returned string is copied to a special variable $_
> |Do we have such things for getc(), too?
>
> No, implicit global variables are evil. I'd rather remove $_ in the
> future.
>
> matz.

Oooooh, I love it when matz talks like that!
http://talklikeaduck.denh...articles/2007/06/05/money-is-the-r...

--
Rick DeNatale

My blog on Ruby
http://talklikeaduck.denh...

Rick DeNatale

6/6/2007 3:35:00 AM

0

On 6/5/07, James Edward Gray II <james@grayproductions.net> wrote:
> On Jun 5, 2007, at 8:55 AM, Sun Park wrote:
>
> > I use global variables for golfing only.. :) but please don't
> > remove $_!
>
> This is probably a good argument for removing the variable. ;)
>
> James Edward Gray II

As both a dedicated Rubyist, and an astronomically high-handicap USGA
member, I'm all for getting rid of both $_ AND golfing from Ruby.
Golf is for getting away from the computer. <G>

--
Rick DeNatale

My blog on Ruby
http://talklikeaduck.denh...

Bertram Scharpf

6/6/2007 6:42:00 AM

0

Hi,

Am Dienstag, 05. Jun 2007, 22:48:55 +0900 schrieb Yukihiro Matsumoto:
> [...] implicit global variables are evil. I'd rather remove $_ in the
> future.

I _never_ use $_ in any 'def'ed method but I use it in
_every_ '-ne'/'-pe' oneliner. Please keep it.

Bertram


--
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-...