Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Ah ha, yes I would say it would make sense to pick one, but only if that one is doublequotes ;)

Personally I have a few reasons why singlequotes are inferior:

- String interpolation requires doublequotes

- Using an apostrophe requires you to escape it or use doublequotes

- They're harder to type on a Japanese-layout keyboard, which I use (it's shift+7, lol), which is otherwise really efficient for Ruby

But there are arguments against doublequotes too:

- I guess they're maybe harder to type on an ANSI keyboard?

- They parse ASCII escape codes, and singlequotes don't

But in my experience I need to use interpolation and apostrophes more than I care about not parsing \r so I use doublequotes everywhere in my own codebase.

So I would just rather not force either, as people seem to feel strongly both ways and the added frustration is probably worse for productivity than having it look a bit neater :)

Honestly I think the "community" chose wrongly in trying to standardise on singlequotes-unless-you-need-interpolation, when it should probably be doublequotes-unless-you-have-a-good-reason, but it's pretty hard to change that now.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: