Without syntax highlighting skimming over Coffee code is awful because you can't distinguish code from variables easy enough.
This is easier to read:
a && b && !c
Than this: a and b and not c
The form with symbols is easier to process because you can clearly distinguish its parts.What's cryptic about ?: ? You learn it just like you learn if ... then ... else and that's it, not cryptic anymore.
Not to mention the yes/true/on thing. What a waste of reserved words.
Text-like does not mean comprehensible. If that was true, then we'd write Coffee like this:
function sum with arguments left and right means
the result is left plus right
That's a lot less cryptic, right ?I also feel your semantic example is overly obtuse.
func SumOf left and right is left + right
--
result is SumOf left and right
--
Exactly what I think of if ... then ... else
IMHO, your plus sign is "pointlessly terse and cryptic". See what I did there? Now seriously, why func? I prefer Coffee's (arg1, arg2, ...) -> syntax for functions. What strikes me as odd is the fact that such a slim language gets verbose in such aspects.
Of course my example is overly obtuse: it's just an hyperbole!
But anyways, I suspect the if ... then ... else syntax is just a side-effect of ? being used as an existential operator in CoffeeScript.
No, I don't see what you did there because + has one and only one meaning, and that is add. Every child can identify what + means, the same cannot be said for (a,b) ->, even to developers who have developed their entire lives (unless they have experience with coffeescript). Hence, cryptic.
It's hilarious how you state some fact explicitly with your own words and yet completely fail to realize this fact.
Readability is not to be confused with familiarity - and you do exactly this. You say that if you learn something it becomes readable, which is not the point, and not true at all.
Think of readability as a measure of how many things you need to learn to understand something. If you introduce a symbol which meaning is completely arbitrary and needs to be learned, you make your code less readable. While Wikipedia page[1] concentrates on the readability of texts written in natural language, it suggests that the more words the text uses, the harder it is to read.
The second part of readability is text length, and so sometimes introducing a symbol to represent common concept, while making it harder to read by itself, makes the program more readable as a whole because it makes the program shorter. It's a trade-off that needs to be considered when designing a language.
The 'class' keyword in CS is a good example: it codifies a useful idiom, that in JS takes 5 lines of code, into a single word. While you need to learn it's meaning, which on the one hand makes the program less readable, on the other hand it reduces the length of certain class of programs significantly and so it makes them much more readable than JS counterparts.
The 'if ... then ... else' is a bad example. The ternary operator does not reduce the length of any program significantly, especially in the presence of the 'switch' statement. Every time you use a ternary operator you still need a test, true expression and false expression. Ternary operator introduces the infix syntax, and not one, but two symbols that you need to learn. It's bad, really bad for readability.
The code written like this:
if (alive and kicking or dead) then (something) else (something els)
is much more readable than equivalent: (alive&&kicking||dead) ? (something) : (something els)
because the latter is not significantly shorter and it introduces as many as 4 (!) symbols with arbitrary meaning. You may not recognize this, because you already know the meaning of all of these, but objectively the latter form is less readable.Your statement that boolean operators are more readable as symbols than as words is simply not true, at least if we use the definition of readability from wikipedia. You are much more comfortable with these operators as symbols, you're more familiar with them and used to them, but that is something entirely different than readability. You think that it's readable, while it's not.
I wish more people actually knew what readability is. Relevant info is just a click away, yet everyone seems to have his own definition of readability, which makes any discussion highly subjective and useless in the long term.
[EDIT] Forgot to mention, this is exactly why I find discussions on Lisp or Smalltalk syntax so infuriating. People are not interested how readable the syntax actually is, that is - how many symbols it introduces and how many of them are reused in different places. They say that the new syntax is "unreadable", while it is much more readable than alternatives, just unfamiliar.
Finally, drop the idea that your view is "objective" and there aren't different opinions on readability.
EDIT: what I mean is that discussing readability is pointless if all the participants have different definitions. I agree that the wikipedia page I linked to does not provide the best possible definition because it talks about texts in natural languages and we're talking about source code. Still, using not-the-best definition is better than using many different definitions.
And I don't disagree with you. Coffee is less readable than JavaScript: "->" is less readable than "function", for example, and "@" is less readable than "this". It's a matter of trade-offs, these shortcuts make the language harder to read, but easier to write; the assumption here is that people will be able to deal with this level of brevity when reading.
I went and googled for a bit for articles talking about code readability, I found a few interesting discussions:
http://queue.acm.org/detail.cfm?id=957782
http://www.perlmonks.org/?node_id=592616
http://www.joelonsoftware.com/articles/Wrong.html
Worth reading.
It says what it does then, doesn't it?