It's funny, because as a big fan of Python who has had to do a lot of CoffeeScript lately, I find CoffeeScript very similar to Python, and very readable. It's certainly more readable than JavaScript, when you don't get fancy. It's called "Unfancy JavaScript" for a reason.
Many of the issues raised in this article can be solved by "simply" not doing it (admittedly not always a real solution). Just because the language allows something to be done, doesn't mean it should be done that way. Our team has a styleguide that clearly explains good and bad practice, for CoffeeScript AND Python. (It's possible to do bonkers stuff in Python, too, just harder.) It includes things like: use explicit returns, especially when intending to return nothing; include parenthesis unless it's more clear without them (callback as arguments).
Yes, it'd be great if the language were more explicit and made it harder to do confusing thing. But, its core goal is being "just javascript", which prevents some of that explicitness. Also, the flexibility lets the real goal be clarity.
because it doesn't have all the crap. CoffeeScript's whitespace syntax is even more helpful when those objects start getting nested. Plus, not having to deal with trailing commas is amazing. At the same time,
I try to not be "that guy" when it comes to CoffeeScript, but it's easily one of my favorite languages now. All the crap that JavaScript requires is just gone.
But far better, if you have any say in it, is making the callback the final argument to someFn.
someFn arg1, arg2, arg3, -> doStuffInACallback()
The thing about coffeescript is that most of the pitfalls being discussed here are very easily avoided with a modicum of experience and sense, whereas in javascript, many of the core issues simply cannot be avoided, and must be worked around in plainly ugly and bug prone ways (see: string concatenation, this/that juggling, "])})]));, just for starters).
I do every day, both in CoffeeScript and in Python. I find things like braces frustrating, because I already keep it indented, and have to then manage the openings and closings. With proper 'aesthetics', indentation is perfectly readable. Plus, if something starts getting too indented than is readable, it's a sign that it needs to be refactored. (Whereas JavaScript looks messy even with otherwise sensible nesting.)
Sorry, CS and Python treat whitespace as a significantly different beasts. It's a disservice to everyone to say, "I read <insert significant-whitespace-block language> everyday, therefore <insert language that substitutes anything from call points, to auto-insert this or that, infer types, etc> is just fine!"
I think a majority can grok and parse Python, but the same can certainly not be said for CS. It's unfortunate too, because it has some Good Parts.
I didn't mean to say "Python does it, so CoffeeScript is not a problem", but rather that both can suffer from too much indentation. CoffeeScript is a little more prone, given the callback-heavy nature of JavaScript, but similar treatment of surrounding whitespace is helpful in maintaining clarity. (Basic example: I find Python's standard of four-space indentation helps CoffeeScript readability, and prefer it over the popular two-space indentation.) And in both cases, excessive indentation is a useful signal.
Readability is very subjective and depends on the user's knowledge of the language, as well as personal style, or 'accent', if you will. Code written with, for example, leading commas in dictionaries instead of trailing commas just looks bizarre to me and is a little harder to read, to me, even though I like to do something similar and stack colons.
yeah python is still much clearer than coffee. I used to somewhat prefer significant whitespace but coffee has definitely killed that for me haha. Seeing braces after looking at files of coffee is like a breathe of fresh air, it just lines up nicely for the eyes, even from an "artistic" stand-point I think the balance is more appealing
Many of the issues raised in this article can be solved by "simply" not doing it (admittedly not always a real solution). Just because the language allows something to be done, doesn't mean it should be done that way. Our team has a styleguide that clearly explains good and bad practice, for CoffeeScript AND Python. (It's possible to do bonkers stuff in Python, too, just harder.) It includes things like: use explicit returns, especially when intending to return nothing; include parenthesis unless it's more clear without them (callback as arguments).
Yes, it'd be great if the language were more explicit and made it harder to do confusing thing. But, its core goal is being "just javascript", which prevents some of that explicitness. Also, the flexibility lets the real goal be clarity.
I find
to be more clear than because it doesn't have all the crap. CoffeeScript's whitespace syntax is even more helpful when those objects start getting nested. Plus, not having to deal with trailing commas is amazing. At the same time, can be confusing, so parens help: I try to not be "that guy" when it comes to CoffeeScript, but it's easily one of my favorite languages now. All the crap that JavaScript requires is just gone.