Feb 25, 2013

Literate CoffeeScript

CoffeeScript 1.5.0 was released today! Although CoffeeScript Love is still anxiously awaiting support for source maps, this release contains something really cool.

Version 1.5 introduces Literate CoffeeScript, an implementation of literate programming, which now enables you to generate plush, Markdown-based documentation from your CoffeeScript programming code. That CoffeeScript creator Jeremy Ashkenas enthusiastically pushed through this feature should come as no surprise. It is a natural extension of his earlier Docco project. Docco uses a side-by-side layout for commentary and code, whereas Literate CoffeeScript appears to be inline, but they both look fabulous. I really admire Jeremy's attention to aesthetics in these projects.

Just take a look at this initial example from the CoffeeScript compiler.



This is how the source for the same output looks in a text editor with syntax highlighting.



So, if you're writing a library in CoffeeScript, consider doing it literate-style. And if that isn't enough excitement for one day, for item in list by -1 now enables you to iterate backwards!

Update: Jeremy Ashkenas has written this blog post about Literate CoffeeScript and his own programming workflow.


Feb 8, 2013

CoffeeScript Debugger in RubyMine



CoffeeScript Love is so happy to see JetBrains including support for CoffeeScript debugging in the latest version of RubyMine, released yesterday. However, the setup instructions are not trivial, and involve source maps, CoffeeScriptRedux, and a JetBrains extension for Chrome. In order to help with the onerous setup, JetBrains has published an example project on GitHub, but it is a full Rails application, and probably not useful for developers who want a simple configuration for pure CoffeeScript projects.

Personally, although I use RubyMine, I won't be tackling this at the moment, as I haven't had any trouble so far debugging CoffeeScript using only the browser. However, as CoffeeScript continues to grow in popularity and the projects using it expand and mature, I can imagine IDE-based debugging may be very helpful while trying to come to grips with large-scale legacy projects.