|
The CoffeeScript compiler is written in pure CoffeeScript, using a small DSL on top of the Jison parser generator, and is available as a Node.js utility.
The core compiler however, does not depend on Node, and can be run in other server-side-JavaScript environments, or in the browser.
CoffeeScript uses Python-style significant whitespace, so line endings are regarded as code endings as well.
Here are some key features of "CoffeeScript":
· Functions are defined by a list of parameters, an arrow, and the function body.
· Significant whitespace
· Use a colon : to assign, as in JSON
· Object and Array literals look very similar to their JavaScript cousins.
· The CoffeeScript compiler takes care to make sure that all of your variables are properly declared within lexical scope
· If/else statements can be written without the use of parentheses and curly brackets
· CoffeeScript provides splats ..., both for function definition as well as invocation, making variable numbers of arguments a little bit more palatable
· The main difference from JavaScript is that the while loop can be used as an expression, returning an array containing the result of each iteration through the loop
· CoffeeScript borrows Ruby's range syntax for extracting slices of arrays
· Function binding
· Embedded JavaScript
· CoffeeScript borrows chained comparisons from Python
· String and RegExp interpolation
· Multiline strings are allowed in CoffeeScript
Requirements:
· Node.js 0.1.90 or higher
What's New in This Release: [ read full changelog ]
· The CoffeeScript compiler now strips Microsoft's UTF-8 BOM if it exists, allowing you to compile BOM-borked source files.
· Fixed Node/compiler deprecation warnings by removing registerExtension, and moving from path.exists to fs.exists.
· Small tweaks to splat compilation, backticks, slicing, and the error for duplicate keys in object literals.
Via: CoffeeScript 1.4.0
0 Comment:
Post a Comment