Skip to content

Intentional Deviations From jashkenas coffee script

Michael Ficarra edited this page Jan 6, 2014 · 9 revisions

The goal of this page is to build an exhaustive list of deviations in either accepted language or output semantics from jashkenas/coffee-script. Unintentional deviations that are known will be listed among the issues labeled bug or on the roadmap. Intentional interface changes will not be listed here, as the command line and module interfaces have been drastically changed. It was never a goal of this project to have compatible interfaces suitable for drop-in replacement.

First things first: many bugs from jashkenas/coffee-script have been fixed in this implementation. I have labeled all open bugs that were fixed by this project with the fixed in redux tag. While some have since been fixed in jashkenas/coffee-script, many are still open. At the time of this writing, 43 are still open, while 64 have been closed. The most notable fixed bug, which involves a fairly major change to the language, is the sub-block terminator issue, #1275. Each indentation level must be consistently indented until its parent is closed. Another change to note comes from fixing #1601, which proposed removing postfix ::.

Here we go:

  • explicit require.extensions registration: In order to require .coffee files, you must explicitly register the CoffeeScript compiler instance with that extension. Simply call the module's CoffeeScript.register method or require coffee-script-redux/register. This corresponds to the planned change in jashkenas/coffee-script#2323, but it is not implemented yet in jashkenas/coffee-script, so could easily trip people up.

  • semicolon operator: Semicolons are semantic. See the discussion in #208. They will still work at the end of most lines, but you should only use them as you would JavaScript's sequence (comma) operator. Using semicolons as line terminators has always been highly discouraged.

  • @-vars in parameter lists can no longer be accessed using their local variable names, e.g. (@a) -> a. See #1007.

  • assignment as right operand of higher-precedence infix operators: See #43.

  • a try-finally implies an empty catch just like try with no catch or finally. See #197.

Clone this wiki locally