From d7b6996bcfe79a2bb42e0fab818b15f0bc4c697b Mon Sep 17 00:00:00 2001 From: Jeremy Ashkenas Date: Thu, 23 Dec 2010 13:30:35 -0800 Subject: [PATCH] Documentation tweaks, up to Language Reference. --- documentation/index.html.erb | 66 +++++++++++++++++++++++------------- index.html | 66 +++++++++++++++++++++++------------- 2 files changed, 86 insertions(+), 46 deletions(-) diff --git a/documentation/index.html.erb b/documentation/index.html.erb index 5eb7fe98..62404556 100644 --- a/documentation/index.html.erb +++ b/documentation/index.html.erb @@ -55,7 +55,7 @@ Everything is an Expression Operators and Aliases Classes, Inheritance, and Super - Pattern Matching + Destructuring Assignment Function Binding Embedded JavaScript Switch and Try/Catch @@ -149,18 +149,20 @@

- The CoffeeScript compiler - is itself written in CoffeeScript, - using the Jison parser generator. The command-line - version of coffee is available as a Node.js utility. - The core compiler however, does not depend on Node, and can be run in any - JavaScript environment, or in the browser (see "Try CoffeeScript", above). + The CoffeeScript compiler is itself + written in CoffeeScript, + using the Jison parser generator. The + command-line version of coffee is available as a + Node.js utility. The + core compiler however, does not + depend on Node, and can be run in any JavaScript environment, or in the + browser (see "Try CoffeeScript", above).

To install, first make sure you have a working copy of the latest stable version of - Node.js, and NPM - (the Node Package Manager). You can then install CoffeeScript with NPM: + Node.js, and npm + (the Node Package Manager). You can then install CoffeeScript with npm:

@@ -187,9 +189,9 @@ sudo bin/cake install

- Both of these provide the coffee command, which can execute - coffee scripts, compile .coffee files into .js, and - provides an interactive REPL. The coffee command takes the + Once installed, you should have access to the coffee command, + which can execute scripts, compile .coffee files into .js, + and provide an interactive REPL. The coffee command takes the following options:

@@ -302,7 +304,7 @@ Expressions --nodejs The node executable has some useful options you can set, - such as --debug and --max-stack-size. Use this + such as
--debug and --max-stack-size. Use this flag to forward options directly to Node.js. @@ -311,12 +313,30 @@ Expressions

Examples:

- -
-coffee -o lib/ -c src/
-coffee --watch --lint experimental.coffee
-coffee --print app/scripts/*.coffee > concatenation.js
-coffee --bare --print --stdio
+ +

@@ -704,8 +724,8 @@ coffee --bare --print --stdio

- - Pattern Matching (Destructuring Assignment) + + Destructuring Assignment To make extracting values from complex arrays and objects more convenient, CoffeeScript implements ECMAScript Harmony's proposed destructuring assignment @@ -721,12 +741,12 @@ coffee --bare --print --stdio

<%= code_for('multiple_return_values', 'forecast') %>

- Pattern matching can be used with any depth of array and object nesting, + Destructuring assignment can be used with any depth of array and object nesting, to help pull out deeply nested properties.

<%= code_for('object_extraction', 'name + " — " + street') %>

- Pattern matching can even be combined with splats. + Destructuring assignment can even be combined with splats.

<%= code_for('patterns_and_splats', 'contents.join("")') %> diff --git a/index.html b/index.html index 7b5bc706..d6c29499 100644 --- a/index.html +++ b/index.html @@ -33,7 +33,7 @@ Everything is an Expression Operators and Aliases Classes, Inheritance, and Super - Pattern Matching + Destructuring Assignment Function Binding Embedded JavaScript Switch and Try/Catch @@ -224,18 +224,20 @@ cubes = (function() {

- The CoffeeScript compiler - is itself written in CoffeeScript, - using the Jison parser generator. The command-line - version of coffee is available as a Node.js utility. - The core compiler however, does not depend on Node, and can be run in any - JavaScript environment, or in the browser (see "Try CoffeeScript", above). + The CoffeeScript compiler is itself + written in CoffeeScript, + using the Jison parser generator. The + command-line version of coffee is available as a + Node.js utility. The + core compiler however, does not + depend on Node, and can be run in any JavaScript environment, or in the + browser (see "Try CoffeeScript", above).

To install, first make sure you have a working copy of the latest stable version of - Node.js, and NPM - (the Node Package Manager). You can then install CoffeeScript with NPM: + Node.js, and npm + (the Node Package Manager). You can then install CoffeeScript with npm:

@@ -262,9 +264,9 @@ sudo bin/cake install

- Both of these provide the coffee command, which can execute - coffee scripts, compile .coffee files into .js, and - provides an interactive REPL. The coffee command takes the + Once installed, you should have access to the coffee command, + which can execute scripts, compile .coffee files into .js, + and provide an interactive REPL. The coffee command takes the following options:

@@ -377,7 +379,7 @@ Expressions --nodejs The node executable has some useful options you can set, - such as --debug and --max-stack-size. Use this + such as
--debug and --max-stack-size. Use this flag to forward options directly to Node.js. @@ -386,12 +388,30 @@ Expressions

Examples:

- -
-coffee -o lib/ -c src/
-coffee --watch --lint experimental.coffee
-coffee --print app/scripts/*.coffee > concatenation.js
-coffee --bare --print --stdio
+ +

@@ -1385,8 +1405,8 @@ tom.move();;'>run

- - Pattern Matching (Destructuring Assignment) + + Destructuring Assignment To make extracting values from complex arrays and objects more convenient, CoffeeScript implements ECMAScript Harmony's proposed destructuring assignment @@ -1430,7 +1450,7 @@ weatherReport = function(location) { }; _ref = weatherReport("Berkeley, CA"), city = _ref[0], temp = _ref[1], forecast = _ref[2];;alert(forecast);'>run: forecast

- Pattern matching can be used with any depth of array and object nesting, + Destructuring assignment can be used with any depth of array and object nesting, to help pull out deeply nested properties.

futurists =
@@ -1467,7 +1487,7 @@ futurists = {
 };
 _ref = futurists.poet, name = _ref.name, _ref2 = _ref.address, street = _ref2[0], city = _ref2[1];;alert(name + " — " + street);'>run: name + " — " + street

- Pattern matching can even be combined with splats. + Destructuring assignment can even be combined with splats.

tag = "<impossible>"