Hacker News new | ask | show | jobs
by jfhufl 3025 days ago
Funny, I love Ruby and it's my primary language of choice, but I'm a heretic, using braces whenever I can:

    # events per day
    ndbh.fetch('select ts from tbl').all.map { |row| 
        row[:ts]
    }.map { |t|
        t.strftime('%Y-%m-%d')
    }.each { |day|
        days[day] += 1
    }
(yes this could be conciser)

This is generally frowned on, and I'm sure everyone who likes having this style

   foo
     .map {}
     .select {}
     .blah {}
will frown as well, but it's so much more visually appealing to me, coming from a C/perl background when I first encountered Ruby (many years ago).

Funny how important syntax is. So easy to look at code in another style/language and go THATS NOT RIGHT!!

1 comments

> Funny how important syntax is. So easy to look at code in another style/language and go THATS NOT RIGHT!!

I'm waaay too picky in this aspect. I once was reading about Ada (before my bias towards C-like languages kicked in). It looked interesting and all, and I was like "Hmm, not bad, learning this might be interesti--"

> Put_Line

Nope.

The irony here is, my current language of choice is Go, and tests must be named like `TestType_Method` and I'm like "arrrgggghhh".

EDIT: Btw I don't really mind indentation styles, brace placement, "dot placement" (like your example) and those things, as long as they're consistent across the codebase.