2011-12-13

CoffeeScript or Dart, Javascript Replacement?

Perm URL with updates: http://xahlee.org/comp/CoffeeScript_Dart_Javascript.html

Good article i agree on:

A Case Against Using CoffeeScript (2011-12-10) By Ryan Florence. @ Source ryanflorence.com

Every point he mentioned i agree. Here's some elaborations on some syntax aspects:

  • Don't be a fucking 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 fuck 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 (e.g. HTML) instead, like in Mathematica. (e.g. 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 to know how the code is nested.
  • Don't fuck with symbols. Don't replace && || by and or. Or replacing {} by begin end (Ruby commit this idiocy). Math uses symbols for a reason. If you can, incorporate Unicode symbols in your lang.
  • Don't be a fucking smartass and start to use complex things such as the idiotic lisp macros, or Python's “List Comprehension”, or “closures” fuck. The perl idiots are the group that loves to diddle code at syntax level (e.g. the one-liner fuck). Stick with basic code, and even avoid idioms. 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.

Q: What's Dart in a nutshell?
A: Javascript with Java syntax.

For general understanding of syntax and formatting, see:

For essays on use of symbols in syntax, see:

For some semantic issues, see: