News for hackers. Stuff that matters.
Re:CoffeeScript One Liners by endtime on Thursday June 02, 2011 @08:52AM (#2611733)
>English is English, code is code.

I'm not sure this kind of 'render unto Caesar' thinking is conducive to literate code.

Definitely agree with you on the suffix conditionals.

Re:CoffeeScript One Liners by thenduks on Thursday June 02, 2011 @12:20PM (#2612607)
I just don't think that forcing code to read like English necessarily makes the code any more readable. Sure, if you read it out loud it comes out sounding somewhat like a sentence. That's cool and everything, but when I'm reading code to, you know, understand it... I want it to be succinct and completely unambiguous.

Here's a great example from Ruby: `unless is_allowed == false`

Reads like English? Check. Sane code? No way. As @heycarsten put it: http://twitter.com/#!/heycarsten/status/28042439329

So I'm suggesting that 'reads like English' isn't the goal you should be aiming for. It's sane, readable code. Sometimes that's English-like (`return x if y`) and other times it's code-like (`list.map( func )`).

Obviously there's room for personal preferences to color where you fall on this (and most other things) :)

Re:CoffeeScript One Liners by endtime on Thursday June 02, 2011 @01:05PM (#2612822)
That's not really a non-irrelevant example - it isn't different from a double-negative, which isn't a good way to write non-confusing English.

I don't see a problem with something like `unless forbidden`, though.

Re:CoffeeScript One Liners by thenduks on Thursday June 02, 2011 @03:12PM (#2613445)
Fair enough, I'm only saying that 'like English' isn't some kind of holy grail of understandable code. I like code, I can read code, not every line needs to be turned into a sentence.