From c7cb308b6dab49add9c357bb3da7f1f38c6e16c7 Mon Sep 17 00:00:00 2001 From: Jeremy Ashkenas Date: Mon, 11 Jan 2010 09:09:06 -0500 Subject: [PATCH] adding note about parens-around-ambiguous-function-defs to the docs --- documentation/index.html.erb | 10 ++++++++-- index.html | 12 +++++++++--- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/documentation/index.html.erb b/documentation/index.html.erb index 47622c92..22e997d2 100644 --- a/documentation/index.html.erb +++ b/documentation/index.html.erb @@ -499,11 +499,17 @@ coffee --print app/scripts/*.coffee > concatenation.js so you don't have to close the parentheses on the other side.

<%= code_for('blocks') %> +

+ If you prefer not to use blocks, you'll need to add a pair of parentheses + to help distinguish the arguments from the definition of the function: + _.map(array, (num => num * 2)) +

Embedded JavaScript - If you ever need to interpolate literal JavaScript snippets, you can - use backticks to pass JavaScript straight through. + Hopefully, you'll never need to use it, but if you ever need to intersperse + snippets of JavaScript within your CoffeeScript, you can + use backticks to pass it straight through.

<%= code_for('embedded', 'hi()') %> diff --git a/index.html b/index.html index 63bfc390..6060bc0f 100644 --- a/index.html +++ b/index.html @@ -1119,11 +1119,17 @@ tom.move(); }); });
+

+ If you prefer not to use blocks, you'll need to add a pair of parentheses + to help distinguish the arguments from the definition of the function: + _.map(array, (num => num * 2)) +

Embedded JavaScript - If you ever need to interpolate literal JavaScript snippets, you can - use backticks to pass JavaScript straight through. + Hopefully, you'll never need to use it, but if you ever need to intersperse + snippets of JavaScript within your CoffeeScript, you can + use backticks to pass it straight through.

hi: `function() {
   return [document.title, "Hello JavaScript"].join(": ");
@@ -1285,7 +1291,7 @@ world...";
     

0.2.3 Axed the unsatisfactory ino keyword, replacing it with of for - object comprehensions. They now look like: for key, value of object. + object comprehensions. They now look like: for prop, value of object.