News for hackers. Stuff that matters.
Re:Ruby Tips Part 1 by ldubinets on Monday September 02, 2013 @01:44PM (#6316201)
Ruby is neat! Except for this part:

    return nil unless other.is_a?(self.class)
Re:Ruby Tips Part 1 by Groxx on Monday September 02, 2013 @04:31PM (#6317032)
I'm a fan of:

  while true do
    puts 'lol'
  end unless true
but seriously, I like postconditions. they're also handy for encoding intent, if you have a pattern of the left-hand-side being the primary logic flow.
Re:Ruby Tips Part 1 by xentronium on Monday September 02, 2013 @03:08PM (#6316593)
Is it a statement-modifier 'unless' that bothers you? `return ... unless ...` is kind of idiomatic way of returning early in the function. You get used to this shortcut ridiculously fast.
Re:Ruby Tips Part 1 by klibertp on Monday September 02, 2013 @02:41PM (#6316470)
Wait, why? Try to read it aloud and it will make sense. I've seen lot's of hard and confusing syntax but this is not one of them. And I'm not a Ruby developer.
Re:Ruby Tips Part 1 by cheald on Monday September 02, 2013 @03:07PM (#6316588)
Post conditions are odd if you're not used to them, but once you start to mentally allow for them, they're really quite nice.
Re:Ruby Tips Part 1 by ldubinets on Monday September 16, 2013 @02:13AM (#6391898)
Ah, seems everybody misunderstood my comment (not hard to see why). It's not the post conditions that bother me, its the dynamic typing! In my opinion, ruby's duck typing really only works until you actually need it.
Re:Ruby Tips Part 1 by waxjar on Tuesday September 03, 2013 @01:42PM (#6322388)
this can also be written as

    other.is_a?(self.class) || return
if you prefer that.