CoffeeScript Supports Literate Programming
Written by Alex Denham   
Wednesday, 27 February 2013

The latest release of CoffeeScript has a new ‘literate’ mode to make it easier to develop Markdown documents that are executable.

CoffeeScript is a small language that compiles into the equivalent JavaScript with no interpretation at runtime.

It is described by the developers as an attempt to expose the good parts of JavaScript in a simple way. You can use any existing JavaScript library seamlessly from CoffeeScript, and the compiled output remains readable, passes through JavaScript Lint without warnings, will work in every JavaScript runtime, and tends to run as fast or faster than the equivalent handwritten JavaScript.

The ‘Literate Programming’ mode is optional, and is used to make code more readable. If a file is marked as ‘.litcoffee’. then when the compiler is compiling it to JavaScript, anything that isn't indented is discarded, and only the indented text is compiled.

This means that Markdown code results in an output file that can be completely compiled, because in Markdown indenting is used to denote source code. Markdown is a text-to-HTML conversion tool for web writers. It allows you to write in plain text format, then convert it to structurally valid XHTML (or HTML).

 

 

The output can also be used to create formatted documents, and can be displayed in editors with syntax highlighting. The announcement about the new feature on the CoffeeScript website says that as 1.5.0 is the first version of CoffeeScript that supports literate programming, they’d like to know if you have any ideas for improving the feature.

The other main changes to the new version are a move to the Node.js Read-eval-print-loop (REPL) format, support for negative loop counters to work through arrays backwards, and disallowing the return of values from constructors.

More Information

CoffeeScript

Related Articles

Programming in CoffeeScript (book review)

CoffeeScript: Accelerated JavaScript Development (book review)

JavaScript Assembly Language

JavaScript debugging tools move forward

JavaScript creator talks about the future

 

 

To be informed about new articles on I Programmer, install the I Programmer Toolbar, subscribe to the RSS feed, follow us on, Twitter, Facebook, Google+ or Linkedin,  or sign up for our weekly newsletter.

 

espbook

 

Comments




or email your comment to: comments@i-programmer.info

 

Banner


Highlights Of The Europe 2024 PostgreSQL Conference
22/11/2024

This year's premium conference for PostgreSQL took place in Athens, Greece between October 22-25. The nice Athenian weather and cultural aspect aside, the conference was a big hit too.



Wasmer 5 Adds iOS Support
12/11/2024

The Wasmer team has released Wasmer 5.0. The WebAssembly runtime adds experimental support for more back ends including V8, Wasmi and WAMR. It also now has iOS support, and upgraded compilers includin [ ... ]


More News

Last Updated ( Wednesday, 27 February 2013 )