New Coder on the Block

Discussion in 'Ruby' started by James Edward Gray II, Aug 25, 2004.

  1. 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
     
    James Edward Gray II, Aug 25, 2004
    #1
    1. Advertisements

  2. James Edward Gray II

    T. Onoma Guest

    This is the place. You'll find all levels of discussion here. And Nuby
    questions tend to get quality answers quickly.
    Interesting idea. I think the closest we have is the occasional coding
    challenge, put out by whomever feels up to it.
    Our beloved _why offers:
    http://www.whytheluckystiff.net/articles/rubyOneEightOh.html

    T.
     
    T. Onoma, Aug 25, 2004
    #2
    1. Advertisements

  3. James Edward Gray II

    David Ross Guest

    Welcome to the ruby community
    One resource is a cpan like database
    (currently only over 100 packages, its expanding
    quickly)

    http://rpa-base.rubyforge.org/wiki/wiki.cgi
    Interesting idea. Don't know of any ruby related.
    Besides _why(the crazy looney funny ruby programmer)'s
    site, there will be a new edition of the Programming
    Ruby book out soon.

    ----------------------------------------
    -- 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
     
    David Ross, Aug 25, 2004
    #3
  4. James Edward Gray II

    James Britt Guest

    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
     
    James Britt, Aug 25, 2004
    #4
  5. James Edward Gray II, Aug 25, 2004
    #5
  6. 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
     
    James Edward Gray II, Aug 25, 2004
    #6
  7. 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
     
    Austin Ziegler, Aug 25, 2004
    #7
  8. James Edward Gray II

    Dave Thomas Guest

    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
     
    Dave Thomas, Aug 25, 2004
    #8
  9. 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
     
    Austin Ziegler, Aug 25, 2004
    #9
  10. 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
     
    Eric Schwartz, Aug 25, 2004
    #10
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.