New Coder on the Block

  • Thread starter James Edward Gray II
  • Start date
J

James Edward Gray II

This is my first post here and I just started learning Ruby a few days
ago, so forgive me if I sound a little ignorant. That said, I do have
some questions...

I come from Perl land and I'm wondering about some similar resources
that I valued there.

First, there is an excellent mailing list called Perl Beginners, where
coders learning the ropes post code they need help with and get tips
from the pros. (The website Perl Monks is similar.) I see that people
are posting code here, but I'm wondering if Ruby has a similar
environment?

Second, the Perl Quiz of the Week is a fun way to test and improve your
skills. I can always try it in Ruby, of course, but it would be great
to see other Ruby solutions and analysis. Any Quiz-like material in
Ruby land?

My final question is about Ruby itself. I'm working my way through
Programming Ruby, which I believe covers Ruby 1.6 or so. I've brought
my installation up to the current 1.8.1 though. Is there place I can
read about what's changed since then?

Thanks for you time.

James Edward Gray II
 
T

T. Onoma

This is my first post here and I just started learning Ruby a few days
ago, so forgive me if I sound a little ignorant. That said, I do have
some questions...

I come from Perl land and I'm wondering about some similar resources
that I valued there.
Welcome!

First, there is an excellent mailing list called Perl Beginners, where
coders learning the ropes post code they need help with and get tips
from the pros. (The website Perl Monks is similar.) I see that people
are posting code here, but I'm wondering if Ruby has a similar
environment?

This is the place. You'll find all levels of discussion here. And Nuby
questions tend to get quality answers quickly.
Second, the Perl Quiz of the Week is a fun way to test and improve your
skills. I can always try it in Ruby, of course, but it would be great
to see other Ruby solutions and analysis. Any Quiz-like material in
Ruby land?

Interesting idea. I think the closest we have is the occasional coding
challenge, put out by whomever feels up to it.
My final question is about Ruby itself. I'm working my way through
Programming Ruby, which I believe covers Ruby 1.6 or so. I've brought
my installation up to the current 1.8.1 though. Is there place I can
read about what's changed since then?

Our beloved _why offers:
http://www.whytheluckystiff.net/articles/rubyOneEightOh.html

T.
 
D

David Ross

This is my first post here and I just started
learning Ruby a few days
ago, so forgive me if I sound a little ignorant.
That said, I do have
some questions...

Welcome to the ruby community
I come from Perl land and I'm wondering about some
similar resources
that I valued there.

One resource is a cpan like database
(currently only over 100 packages, its expanding
quickly)

http://rpa-base.rubyforge.org/wiki/wiki.cgi
Second, the Perl Quiz of the Week is a fun way to
test and improve your
skills. I can always try it in Ruby, of course, but
it would be great
to see other Ruby solutions and analysis. Any
Quiz-like material in
Ruby land?

Interesting idea. Don't know of any ruby related.
My final question is about Ruby itself. I'm working
my way through
Programming Ruby, which I believe covers Ruby 1.6 or
so. I've brought
my installation up to the current 1.8.1 though. Is
there place I can
read about what's changed since then?

Besides _why(the crazy looney funny ruby programmer)'s
site, there will be a new edition of the Programming
Ruby book out soon.
Thanks for you time.

James Edward Gray II


----------------------------------------
-- Name: David Ross
-- Phone: 865.539.3798
-- Email: drossruby [at] yahoo [dot] com
----------------------------------------



__________________________________
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!
http://promotions.yahoo.com/new_mail
 
J

James Britt

T. Onoma said:

Ditto.

You'll find some handy pointers here:

http://www.rubygarden.org/ruby?ThingsNewcomersShouldKnow

Also, a new edition of Programming Ruby is due quite soon. It covers
1.8, as well as topics not in the first edition.

In the meantime, this site may help bridge the gap:

http://phrogz.net/ProgrammingRuby/

It links an online copy of the first edition of Programming Ruby (AKA
The Pickaxe Book) with wiki pages detailing changes in 1.8


James Britt
ruby-doc.org
 
J

James Edward Gray II

Also, a new edition of Programming Ruby is due quite soon. It covers
1.8, as well as topics not in the first edition.

In the meantime, this site may help bridge the gap:

http://phrogz.net/ProgrammingRuby/

It links an online copy of the first edition of Programming Ruby (AKA
The Pickaxe Book) with wiki pages detailing changes in 1.8

Okay, this is a helpful link, but I found this there:

"Deprecate:

• symbol variables ($1 etc)
• regexp in conditional expression
• range (../...) in conditonal expression
• print with no argument == print $_
(But these things are still around in Ruby 1.8, why would you suggest
deprecating them? -- because Matz has said they will be deprecated in
future versions. You can't deprecate them arbitrarily in the book, but
you can call them out as not-future-proof.)"

Wow. That shocked me. Sounds like I better rethink some of the things
I've been learning. Let me ask some clarifying questions here:

" • symbol variables ($1 etc)"

This one will kill me. <laughs> I'm very used to handling my
substitutions this way, being a Perl guy. Can I get an example of "The
Ruby Way" to do a search and replace without these, please?

" • regexp in conditional expression"

Does this mean something like:

if /Ruby/
# ...
end

is not future-proof? What is the correct fix?

if $_ =~ /Ruby/
# ...
end

" • range (../...) in conditonal expression"

I don't use this too often, but it can be a handy shortcut in places.
Any reason this is considered bad? I'm just curious. Really, I guess
I mean that question to apply to the whole list above.

I'm assuming it's because what's going on in these situations isn't
always immediately obvious to readers of code. If that's the case
though, I have to say I disagree with the $1..$9 call. That's a regex
standard and downright handy. It will be missed, by me at least.

Thanks.

James Edward Gray II
 
A

Austin Ziegler

On Aug 24, 2004, at 10:01 PM, James Britt wrote:
" • symbol variables ($1 etc)"

This one will kill me. <laughs> I'm very used to handling my
substitutions this way, being a Perl guy. Can I get an example of "The
Ruby Way" to do a search and replace without these, please? [...]
I'm assuming it's because what's going on in these situations isn't
always immediately obvious to readers of code. If that's the case
though, I have to say I disagree with the $1..$9 call. That's a regex
standard and downright handy. It will be missed, by me at least.

No, it's *not* a regex standard. It's a Perl standard. Regex
"standard" is \1, \2, etc. for backreferences. Look at "ri MatchData"
and you'll begin to see the Object behind a Regexp result -- and
that's the Ruby Way to do it.

-austin
 
D

Dave Thomas

No, it's *not* a regex standard. It's a Perl standard. Regex
"standard" is \1, \2, etc. for backreferences. Look at "ri MatchData"
and you'll begin to see the Object behind a Regexp result -- and
that's the Ruby Way to do it.

I think I'd rather phrase that as "that's _a_ Ruby way to do it." 90%
of the time, I personally find $1 and friends far more convenient, and
use Regexp#match only when I need the match results to be long-lived.


Cheers

Dave
 
A

Austin Ziegler

I think I'd rather phrase that as "that's _a_ Ruby way to do it." 90%
of the time, I personally find $1 and friends far more convenient, and
use Regexp#match only when I need the match results to be long-lived.

True enough. I personally rarely use $1 and friends, but that's just
the way that I program. Are $1 and friends being phased out over time,
though?

-austin
 
E

Eric Schwartz

Austin Ziegler said:
True enough. I personally rarely use $1 and friends, but that's just
the way that I program. Are $1 and friends being phased out over time,
though?

require 'tastes_may_differ'

I certainly hope not. One of the reasons I chose Ruby over Python for
my automated test harness was that regexes in Python are far too
complicated and verbose for my taste, whereas in Ruby, they're simple
and easy, with $1-style variables.

-=Eric
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top