CoffeeScript or JavaScript?
Good article i agree on:
A Case Against Using CoffeeScript By Ryan Florence. At http://ryanflorence.com/2011/2012/case-against-coffeescript/
Every point he mentioned i agree. Here's a summary of his points:
Here is some elaborations on some syntax aspects:
- Don't be a smartass and create a layer of lang on top of a lang and think that you improved it. It introduces complexity.
- The grammar of syntax should be simple, and each symbol should ideally have one and only one meaning. It should never be context dependent. Syntax should be free-flow of sequence of symbols so it can be automatically formatted.
- Don't faak with whitespace like Python and Haskell. Using whitespace for code block makes the semantics of whitespace symbols extremely complicated.
- If you like whitespace indentation for readability, proper solution is to create a layer of format language (For example, HTML) instead, like in Mathematica. (For example, When in a special reader or editor, you have headers, sub-headers, inclusion of images or illustrations, audio, and expressions can be renders as “2-dimensional” math expression.)
- The brackets ()[]{} and other matching pairs 【】〈〉「」 etc are the most important classes of symbols in syntax. They have the property of demarcation at the syntax level. That is, you do not need complex parser or implicit operator precedence rule to know how the code is nested.
- Don't faak with symbols. Don't replace
&& ||
byand or
. Or replacing{}
bybegin end
(Ruby commit this idiocy) and think you improved readability. Math uses symbols for a reason. If you can, incorporate Unicode symbols in your lang. - Don't be a smartass and start to use complex things such as the idiotic lisp macros, or Python's “List Comprehension”, or “closures”. The perl idiots are the group that loves to diddle code at syntax level (For example, the one-liner faak). Stick with basic code, and even avoid idioms. 〔see Why Idioms Are Bad〕 Use these only when the it is natural in the language and really appropriate. Most of time you probably should leave your code verbose.
Moral: Don't use CoffeeScript, also, don't use Google's Dart. Stick with JavaScript .
For general understanding of syntax and formatting, see:
- Concepts and Confusions of Prefix, Infix, Postfix and Lisp Notations
- Fundamental Problems of Lisp, Syntax Irregularity
- What is Point-free Programing? (point-free function syntax)
- Tab vs Space in Source Code
- Programing: the Harm of Hard-wrapping Lines
For essays on use of symbols in syntax, see:
- What is Function, What is Operator?
- Logical Operators, Truth Table, Unicode
- Problems of Symbol Congestion in Computer Languages; ASCII Jam vs Unicode
- Syntax Design: Use of Unicode Matching Brackets as Specialized Delimiters
- HTML6, JSON SXML Simplified
For some semantic issues, see:
- Programing: What are OOP's Jargons and Complexities (OOP Model as FP)
- Why List Comprehension is Bad
- What is Currying in Computer Science?
- Perl One-Liner Screw
CoffeeScript Redux
Addendum.
Dropbox switched to CoffeeScript, and wrote a detailed blog about it: 〔Dropbox dives into CoffeeScript By Dan W, Ziga M, Chris V. AtAlso the guy who wrote the criticism against CoffeeScript, now loves CoffeeScript.