What’s Changed Since CoffeeScript 1.0.0?

Despite being a very young language, CoffeeScript has been remarkably stable in the years since its 1.0.0 release. As of this writing, the latest release is 1.8.0. For the most part, code written for CoffeeScript 1.0.0 will be accepted by the CoffeeScript 1.8.0 compiler, and vice versa. The few exceptions mainly have to do with syntactic edge cases involving implicit parentheses and indentation. Those who like to keep their code as paren-free as possible will be happy to know that ever since CoffeeScript 1.7.0, chaining code like this has worked as expected:

 $(​'h1'​)
  .slideDown 100, => $(​'h2'​).show()
  .fadeIn 300

Personally, I prefer to use explicit parentheses in most cases, and you’ll see that preference expressed in the code shown throughout this book. But this change has definitely made CoffeeScript’s behavior in the absence of parentheses more aligned with human expectations.

But perhaps the biggest leap CoffeeScript has taken in the last few years is not in the language itself, but in the tooling. Since CoffeeScript 1.6.1, the compiler has included the ability to generate source maps, a debugger’s dream come true. Before that, having to look at compiled JavaScript when an error was thrown was one of the most frequent complaints developers had about CoffeeScript. Happily, source maps solve that problem. We’ll talk more about source maps in Using Source Maps.

Another tooling addition is Literate CoffeeScript, which embodies an approach to coding advocated by the great Donald Knuth. In a coffee file, you embed comments in code. But in a litcoffee file, you do the opposite, writing a document in Markdown syntax with embedded snippets of code. The compiler simply extracts those snippets and ignores the rest of the code. The result is a human-readable narrative that doubles as a machine-readable program. Although I don’t use Literate CoffeeScript in this book, I definitely think it’s a cool concept.

For a (nearly) comprehensive list of changes the CoffeeScript project has gone through over time, see the changelog.[11]

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.2.240