mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
Adding an existential infix operator example.
This commit is contained in:
parent
9f56c92497
commit
2ac5ee4062
4 changed files with 101 additions and 94 deletions
|
@ -1,6 +1,8 @@
|
|||
solipsism = true if mind? and not world?
|
||||
|
||||
speed ?= 140
|
||||
speed ?= 75
|
||||
|
||||
footprints = yeti ? "bear"
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -518,12 +518,12 @@ coffee --bare --print --stdio</pre>
|
|||
</p>
|
||||
<%= code_for('range_comprehensions', 'countdown') %>
|
||||
<p>
|
||||
Note how because we are assigning the value of the comprehensions to a
|
||||
variable in the example above, CoffeeScript is collecting the result of
|
||||
Note how because we are assigning the value of the comprehensions to a
|
||||
variable in the example above, CoffeeScript is collecting the result of
|
||||
each iteration into an array. Sometimes functions end with loops that are
|
||||
intended to run only for their side-effects. Be careful that you're not
|
||||
accidentally returning the results of the comprehension in these cases,
|
||||
by adding a meaningful return value, like <tt>true</tt>, or <tt>null</tt>,
|
||||
by adding a meaningful return value, like <tt>true</tt>, or <tt>null</tt>,
|
||||
to the bottom of your function.
|
||||
</p>
|
||||
<p>
|
||||
|
@ -608,7 +608,7 @@ coffee --bare --print --stdio</pre>
|
|||
It can also be used for safer conditional assignment than <tt>||=</tt>
|
||||
provides, for cases where you may be handling numbers or strings.
|
||||
</p>
|
||||
<%= code_for('existence', 'speed') %>
|
||||
<%= code_for('existence', 'footprints') %>
|
||||
<p>
|
||||
The accessor variant of the existential operator <tt>?.</tt> can be used to soak
|
||||
up null references in a chain of properties. Use it instead
|
||||
|
@ -1034,23 +1034,23 @@ coffee --bare --print --stdio</pre>
|
|||
<span id="change_log" class="bookmark"></span>
|
||||
Change Log
|
||||
</h2>
|
||||
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.9.6
|
||||
<b class="header" style="margin-top: 20px;">0.9.6
|
||||
<span class="timestamp"> – <small>Dec 6, 2010</small></span>
|
||||
</b>
|
||||
The REPL now properly formats stacktraces, and stays alive through
|
||||
asynchronous exceptions. Using <tt>--watch</tt> now prints timestamps as
|
||||
files are compiled. Fixed some accidentally-leaking variables within
|
||||
plucked closure-loops. Constructors now maintain their declaration
|
||||
plucked closure-loops. Constructors now maintain their declaration
|
||||
location within a class body. Dynamic object keys were removed.
|
||||
Nested classes are now supported. Fixes execution context for naked
|
||||
Nested classes are now supported. Fixes execution context for naked
|
||||
splatted functions. Bugfix for inversion of chained comparisons.
|
||||
Chained class instantiation now works properly with splats.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.9.5
|
||||
<b class="header" style="margin-top: 20px;">0.9.5
|
||||
<span class="timestamp"> – <small>Nov 21, 2010</small></span>
|
||||
</b>
|
||||
0.9.5 should be considered the first release candidate for CoffeeScript 1.0.
|
||||
|
@ -1066,7 +1066,7 @@ coffee --bare --print --stdio</pre>
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.9.4
|
||||
<b class="header" style="margin-top: 20px;">0.9.4
|
||||
<span class="timestamp"> – <small>Sep 21, 2010</small></span>
|
||||
</b>
|
||||
CoffeeScript now uses appropriately-named temporary variables, and recycles
|
||||
|
@ -1077,7 +1077,7 @@ coffee --bare --print --stdio</pre>
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.9.3
|
||||
<b class="header" style="margin-top: 20px;">0.9.3
|
||||
<span class="timestamp"> – <small>Sep 16, 2010</small></span>
|
||||
</b>
|
||||
CoffeeScript <tt>switch</tt> statements now compile into JS <tt>switch</tt>
|
||||
|
@ -1088,7 +1088,7 @@ coffee --bare --print --stdio</pre>
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.9.2
|
||||
<b class="header" style="margin-top: 20px;">0.9.2
|
||||
<span class="timestamp"> – <small>Aug 23, 2010</small></span>
|
||||
</b>
|
||||
Specifying the start and end of a range literal is now optional, eg. <tt>array[3..]</tt>.
|
||||
|
@ -1104,7 +1104,7 @@ coffee --bare --print --stdio</pre>
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.9.1
|
||||
<b class="header" style="margin-top: 20px;">0.9.1
|
||||
<span class="timestamp"> – <small>Aug 11, 2010</small></span>
|
||||
</b>
|
||||
Bugfix release for <b>0.9.1</b>. Greatly improves the handling of mixed
|
||||
|
@ -1115,7 +1115,7 @@ coffee --bare --print --stdio</pre>
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.9.0
|
||||
<b class="header" style="margin-top: 20px;">0.9.0
|
||||
<span class="timestamp"> – <small>Aug 4, 2010</small></span>
|
||||
</b>
|
||||
The CoffeeScript <b>0.9</b> series is considered to be a release candidate
|
||||
|
@ -1141,7 +1141,7 @@ coffee --bare --print --stdio</pre>
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.7.2
|
||||
<b class="header" style="margin-top: 20px;">0.7.2
|
||||
<span class="timestamp"> – <small>Jul 12, 2010</small></span>
|
||||
</b>
|
||||
Quick bugfix (right after 0.7.1) for a problem that prevented <tt>coffee</tt>
|
||||
|
@ -1149,7 +1149,7 @@ coffee --bare --print --stdio</pre>
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.7.1
|
||||
<b class="header" style="margin-top: 20px;">0.7.1
|
||||
<span class="timestamp"> – <small>Jul 11, 2010</small></span>
|
||||
</b>
|
||||
Block-style comments are now passed through and printed as JavaScript block
|
||||
|
@ -1159,7 +1159,7 @@ coffee --bare --print --stdio</pre>
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.7.0
|
||||
<b class="header" style="margin-top: 20px;">0.7.0
|
||||
<span class="timestamp"> – <small>Jun 28, 2010</small></span>
|
||||
</b>
|
||||
Official CoffeeScript variable style is now camelCase, as in JavaScript.
|
||||
|
@ -1178,7 +1178,7 @@ coffee --bare --print --stdio</pre>
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.6.2
|
||||
<b class="header" style="margin-top: 20px;">0.6.2
|
||||
<span class="timestamp"> – <small>May 15, 2010</small></span>
|
||||
</b>
|
||||
The <tt>coffee</tt> command will now preserve directory structure when
|
||||
|
@ -1195,7 +1195,7 @@ coffee --bare --print --stdio</pre>
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.6.1
|
||||
<b class="header" style="margin-top: 20px;">0.6.1
|
||||
<span class="timestamp"> – <small>Apr 12, 2010</small></span>
|
||||
</b>
|
||||
Upgraded CoffeeScript for compatibility with the new Node.js <b>v0.1.90</b>
|
||||
|
@ -1203,7 +1203,7 @@ coffee --bare --print --stdio</pre>
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.6.0
|
||||
<b class="header" style="margin-top: 20px;">0.6.0
|
||||
<span class="timestamp"> – <small>Apr 3, 2010</small></span>
|
||||
</b>
|
||||
Trailing commas are now allowed, a-la Python. Static
|
||||
|
@ -1212,7 +1212,7 @@ coffee --bare --print --stdio</pre>
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.5.6
|
||||
<b class="header" style="margin-top: 20px;">0.5.6
|
||||
<span class="timestamp"> – <small>Mar 23, 2010</small></span>
|
||||
</b>
|
||||
Interpolation can now be used within regular expressions and heredocs, as well as
|
||||
|
@ -1225,7 +1225,7 @@ coffee --bare --print --stdio</pre>
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.5.5
|
||||
<b class="header" style="margin-top: 20px;">0.5.5
|
||||
<span class="timestamp"> – <small>Mar 8, 2010</small></span>
|
||||
</b>
|
||||
String interpolation, contributed by
|
||||
|
@ -1236,7 +1236,7 @@ coffee --bare --print --stdio</pre>
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.5.4
|
||||
<b class="header" style="margin-top: 20px;">0.5.4
|
||||
<span class="timestamp"> – <small>Mar 3, 2010</small></span>
|
||||
</b>
|
||||
Bugfix that corrects the Node.js global constants <tt>__filename</tt> and
|
||||
|
@ -1245,7 +1245,7 @@ coffee --bare --print --stdio</pre>
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.5.3
|
||||
<b class="header" style="margin-top: 20px;">0.5.3
|
||||
<span class="timestamp"> – <small>Feb 27, 2010</small></span>
|
||||
</b>
|
||||
CoffeeScript now has a syntax for defining classes. Many of the core
|
||||
|
@ -1257,7 +1257,7 @@ coffee --bare --print --stdio</pre>
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.5.2
|
||||
<b class="header" style="margin-top: 20px;">0.5.2
|
||||
<span class="timestamp"> – <small>Feb 25, 2010</small></span>
|
||||
</b>
|
||||
Added a compressed version of the compiler for inclusion in web pages as
|
||||
|
@ -1268,7 +1268,7 @@ coffee --bare --print --stdio</pre>
|
|||
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.5.1
|
||||
<b class="header" style="margin-top: 20px;">0.5.1
|
||||
<span class="timestamp"> – <small>Feb 24, 2010</small></span>
|
||||
</b>
|
||||
Improvements to null soaking with the existential operator, including
|
||||
|
@ -1278,7 +1278,7 @@ coffee --bare --print --stdio</pre>
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.5.0
|
||||
<b class="header" style="margin-top: 20px;">0.5.0
|
||||
<span class="timestamp"> – <small>Feb 21, 2010</small></span>
|
||||
</b>
|
||||
CoffeeScript 0.5.0 is a major release, While there are no language changes,
|
||||
|
@ -1287,7 +1287,7 @@ coffee --bare --print --stdio</pre>
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.3.2
|
||||
<b class="header" style="margin-top: 20px;">0.3.2
|
||||
<span class="timestamp"> – <small>Feb 8, 2010</small></span>
|
||||
</b>
|
||||
<tt>@property</tt> is now a shorthand for <tt>this.property</tt>.<br />
|
||||
|
@ -1296,7 +1296,7 @@ coffee --bare --print --stdio</pre>
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.3.0
|
||||
<b class="header" style="margin-top: 20px;">0.3.0
|
||||
<span class="timestamp"> – <small>Jan 26, 2010</small></span>
|
||||
</b>
|
||||
CoffeeScript 0.3 includes major syntax changes:
|
||||
|
@ -1314,7 +1314,7 @@ coffee --bare --print --stdio</pre>
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.2.6
|
||||
<b class="header" style="margin-top: 20px;">0.2.6
|
||||
<span class="timestamp"> – <small>Jan 17, 2010</small></span>
|
||||
</b>
|
||||
Added Python-style chained comparisons, the conditional existence
|
||||
|
@ -1324,7 +1324,7 @@ coffee --bare --print --stdio</pre>
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.2.5
|
||||
<b class="header" style="margin-top: 20px;">0.2.5
|
||||
<span class="timestamp"> – <small>Jan 13, 2010</small></span>
|
||||
</b>
|
||||
The conditions in switch statements can now take multiple values at once —
|
||||
|
@ -1335,7 +1335,7 @@ coffee --bare --print --stdio</pre>
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.2.4
|
||||
<b class="header" style="margin-top: 20px;">0.2.4
|
||||
<span class="timestamp"> – <small>Jan 12, 2010</small></span>
|
||||
</b>
|
||||
Added ECMAScript Harmony style destructuring assignment, for dealing with
|
||||
|
@ -1344,7 +1344,7 @@ coffee --bare --print --stdio</pre>
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.2.3
|
||||
<b class="header" style="margin-top: 20px;">0.2.3
|
||||
<span class="timestamp"> – <small>Jan 11, 2010</small></span>
|
||||
</b>
|
||||
Axed the unsatisfactory <tt>ino</tt> keyword, replacing it with <tt>of</tt> for
|
||||
|
@ -1352,7 +1352,7 @@ coffee --bare --print --stdio</pre>
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.2.2
|
||||
<b class="header" style="margin-top: 20px;">0.2.2
|
||||
<span class="timestamp"> – <small>Jan 10, 2010</small></span>
|
||||
</b>
|
||||
When performing a comprehension over an object, use <tt>ino</tt>, instead
|
||||
|
@ -1375,14 +1375,14 @@ coffee --bare --print --stdio</pre>
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.2.1
|
||||
<b class="header" style="margin-top: 20px;">0.2.1
|
||||
<span class="timestamp"> – <small>Jan 5, 2010</small></span>
|
||||
</b>
|
||||
Arguments objects are now converted into real arrays when referenced.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.2.0
|
||||
<b class="header" style="margin-top: 20px;">0.2.0
|
||||
<span class="timestamp"> – <small>Jan 5, 2010</small></span>
|
||||
</b>
|
||||
Major release. Significant whitespace. Better statement-to-expression
|
||||
|
@ -1394,7 +1394,7 @@ coffee --bare --print --stdio</pre>
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.1.6
|
||||
<b class="header" style="margin-top: 20px;">0.1.6
|
||||
<span class="timestamp"> – <small>Dec 27, 2009</small></span>
|
||||
</b>
|
||||
Bugfix for running <tt>coffee --interactive</tt> and <tt>--run</tt>
|
||||
|
@ -1403,7 +1403,7 @@ coffee --bare --print --stdio</pre>
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.1.5
|
||||
<b class="header" style="margin-top: 20px;">0.1.5
|
||||
<span class="timestamp"> – <small>Dec 26, 2009</small></span>
|
||||
</b>
|
||||
Array slice literals and array comprehensions can now both take Ruby-style
|
||||
|
@ -1414,7 +1414,7 @@ coffee --bare --print --stdio</pre>
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.1.4
|
||||
<b class="header" style="margin-top: 20px;">0.1.4
|
||||
<span class="timestamp"> – <small>Dec 25, 2009</small></span>
|
||||
</b>
|
||||
The official CoffeeScript extension is now <tt>.coffee</tt> instead of
|
||||
|
@ -1428,7 +1428,7 @@ coffee --bare --print --stdio</pre>
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.1.3
|
||||
<b class="header" style="margin-top: 20px;">0.1.3
|
||||
<span class="timestamp"> – <small>Dec 25, 2009</small></span>
|
||||
</b>
|
||||
The <tt>coffee</tt> command now includes <tt>--interactive</tt>,
|
||||
|
@ -1444,7 +1444,7 @@ coffee --bare --print --stdio</pre>
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.1.2
|
||||
<b class="header" style="margin-top: 20px;">0.1.2
|
||||
<span class="timestamp"> – <small>Dec 24, 2009</small></span>
|
||||
</b>
|
||||
Fixed a bug with calling <tt>super()</tt> through more than one level of
|
||||
|
@ -1458,14 +1458,14 @@ coffee --bare --print --stdio</pre>
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.1.1
|
||||
<b class="header" style="margin-top: 20px;">0.1.1
|
||||
<span class="timestamp"> – <small>Dec 24, 2009</small></span>
|
||||
</b>
|
||||
Added <tt>instanceof</tt> and <tt>typeof</tt> as operators.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.1.0
|
||||
<b class="header" style="margin-top: 20px;">0.1.0
|
||||
<span class="timestamp"> – <small>Dec 24, 2009</small></span>
|
||||
</b>
|
||||
Initial CoffeeScript release.
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
var solipsism;
|
||||
var footprints, solipsism;
|
||||
if ((typeof mind != "undefined" && mind !== null) && !(typeof world != "undefined" && world !== null)) {
|
||||
solipsism = true;
|
||||
}
|
||||
typeof speed != "undefined" && speed !== null ? speed : speed = 140;
|
||||
typeof speed != "undefined" && speed !== null ? speed : speed = 75;
|
||||
footprints = typeof yeti != "undefined" && yeti !== null ? yeti : "bear";
|
100
index.html
100
index.html
|
@ -886,12 +886,12 @@ countdown = (function() {
|
|||
return _results;
|
||||
}());;alert(countdown);'>run: countdown</button><br class='clear' /></div>
|
||||
<p>
|
||||
Note how because we are assigning the value of the comprehensions to a
|
||||
variable in the example above, CoffeeScript is collecting the result of
|
||||
Note how because we are assigning the value of the comprehensions to a
|
||||
variable in the example above, CoffeeScript is collecting the result of
|
||||
each iteration into an array. Sometimes functions end with loops that are
|
||||
intended to run only for their side-effects. Be careful that you're not
|
||||
accidentally returning the results of the comprehension in these cases,
|
||||
by adding a meaningful return value, like <tt>true</tt>, or <tt>null</tt>,
|
||||
by adding a meaningful return value, like <tt>true</tt>, or <tt>null</tt>,
|
||||
to the bottom of your function.
|
||||
</p>
|
||||
<p>
|
||||
|
@ -1111,22 +1111,26 @@ globals = (function() {
|
|||
</p>
|
||||
<div class='code'><pre class="idle">solipsism <span class="Keyword">=</span> <span class="BuiltInConstant">true</span> <span class="Keyword">if</span> mind<span class="Keyword">?</span> <span class="Keyword">and</span> <span class="Keyword">not</span> world<span class="Keyword">?</span>
|
||||
|
||||
speed <span class="Keyword">?</span><span class="Keyword">=</span> <span class="Number">140</span>
|
||||
speed <span class="Keyword">?</span><span class="Keyword">=</span> <span class="Number">75</span>
|
||||
|
||||
footprints <span class="Keyword">=</span> yeti <span class="Keyword">?</span> <span class="String"><span class="String">"</span>bear<span class="String">"</span></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</pre><pre class="idle"><span class="Storage">var</span> solipsism;
|
||||
</pre><pre class="idle"><span class="Storage">var</span> footprints, solipsism;
|
||||
<span class="Keyword">if</span> ((<span class="Keyword">typeof</span> mind <span class="Keyword">!</span><span class="Keyword">=</span> <span class="String"><span class="String">"</span>undefined<span class="String">"</span></span> <span class="Keyword">&</span><span class="Keyword">&</span> mind <span class="Keyword">!</span><span class="Keyword">==</span> <span class="BuiltInConstant">null</span>) <span class="Keyword">&</span><span class="Keyword">&</span> <span class="Keyword">!</span>(<span class="Keyword">typeof</span> world <span class="Keyword">!</span><span class="Keyword">=</span> <span class="String"><span class="String">"</span>undefined<span class="String">"</span></span> <span class="Keyword">&</span><span class="Keyword">&</span> world <span class="Keyword">!</span><span class="Keyword">==</span> <span class="BuiltInConstant">null</span>)) {
|
||||
solipsism <span class="Keyword">=</span> <span class="BuiltInConstant">true</span>;
|
||||
}
|
||||
<span class="Keyword">typeof</span> speed <span class="Keyword">!</span><span class="Keyword">=</span> <span class="String"><span class="String">"</span>undefined<span class="String">"</span></span> <span class="Keyword">&</span><span class="Keyword">&</span> speed <span class="Keyword">!</span><span class="Keyword">==</span> <span class="BuiltInConstant">null</span> ? speed : speed <span class="Keyword">=</span> <span class="Number">140</span>;
|
||||
</pre><button onclick='javascript: var solipsism;
|
||||
<span class="Keyword">typeof</span> speed <span class="Keyword">!</span><span class="Keyword">=</span> <span class="String"><span class="String">"</span>undefined<span class="String">"</span></span> <span class="Keyword">&</span><span class="Keyword">&</span> speed <span class="Keyword">!</span><span class="Keyword">==</span> <span class="BuiltInConstant">null</span> ? speed : speed <span class="Keyword">=</span> <span class="Number">75</span>;
|
||||
footprints <span class="Keyword">=</span> <span class="Keyword">typeof</span> yeti <span class="Keyword">!</span><span class="Keyword">=</span> <span class="String"><span class="String">"</span>undefined<span class="String">"</span></span> <span class="Keyword">&</span><span class="Keyword">&</span> yeti <span class="Keyword">!</span><span class="Keyword">==</span> <span class="BuiltInConstant">null</span> ? yeti : <span class="String"><span class="String">"</span>bear<span class="String">"</span></span>;
|
||||
</pre><button onclick='javascript: var footprints, solipsism;
|
||||
if ((typeof mind != "undefined" && mind !== null) && !(typeof world != "undefined" && world !== null)) {
|
||||
solipsism = true;
|
||||
}
|
||||
typeof speed != "undefined" && speed !== null ? speed : speed = 140;;alert(speed);'>run: speed</button><br class='clear' /></div>
|
||||
typeof speed != "undefined" && speed !== null ? speed : speed = 75;
|
||||
footprints = typeof yeti != "undefined" && yeti !== null ? yeti : "bear";;alert(footprints);'>run: footprints</button><br class='clear' /></div>
|
||||
<p>
|
||||
The accessor variant of the existential operator <tt>?.</tt> can be used to soak
|
||||
up null references in a chain of properties. Use it instead
|
||||
|
@ -1901,23 +1905,23 @@ task(<span class="String"><span class="String">'</span>build:parser<span class="
|
|||
<span id="change_log" class="bookmark"></span>
|
||||
Change Log
|
||||
</h2>
|
||||
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.9.6
|
||||
<b class="header" style="margin-top: 20px;">0.9.6
|
||||
<span class="timestamp"> – <small>Dec 6, 2010</small></span>
|
||||
</b>
|
||||
The REPL now properly formats stacktraces, and stays alive through
|
||||
asynchronous exceptions. Using <tt>--watch</tt> now prints timestamps as
|
||||
files are compiled. Fixed some accidentally-leaking variables within
|
||||
plucked closure-loops. Constructors now maintain their declaration
|
||||
location within a class body.
|
||||
Nested classes are now supported. Fixes execution context for naked
|
||||
plucked closure-loops. Constructors now maintain their declaration
|
||||
location within a class body. Dynamic object keys were removed.
|
||||
Nested classes are now supported. Fixes execution context for naked
|
||||
splatted functions. Bugfix for inversion of chained comparisons.
|
||||
Chained class instantiation now works properly with splats.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.9.5
|
||||
<b class="header" style="margin-top: 20px;">0.9.5
|
||||
<span class="timestamp"> – <small>Nov 21, 2010</small></span>
|
||||
</b>
|
||||
0.9.5 should be considered the first release candidate for CoffeeScript 1.0.
|
||||
|
@ -1933,7 +1937,7 @@ task(<span class="String"><span class="String">'</span>build:parser<span class="
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.9.4
|
||||
<b class="header" style="margin-top: 20px;">0.9.4
|
||||
<span class="timestamp"> – <small>Sep 21, 2010</small></span>
|
||||
</b>
|
||||
CoffeeScript now uses appropriately-named temporary variables, and recycles
|
||||
|
@ -1944,7 +1948,7 @@ task(<span class="String"><span class="String">'</span>build:parser<span class="
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.9.3
|
||||
<b class="header" style="margin-top: 20px;">0.9.3
|
||||
<span class="timestamp"> – <small>Sep 16, 2010</small></span>
|
||||
</b>
|
||||
CoffeeScript <tt>switch</tt> statements now compile into JS <tt>switch</tt>
|
||||
|
@ -1955,7 +1959,7 @@ task(<span class="String"><span class="String">'</span>build:parser<span class="
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.9.2
|
||||
<b class="header" style="margin-top: 20px;">0.9.2
|
||||
<span class="timestamp"> – <small>Aug 23, 2010</small></span>
|
||||
</b>
|
||||
Specifying the start and end of a range literal is now optional, eg. <tt>array[3..]</tt>.
|
||||
|
@ -1971,7 +1975,7 @@ task(<span class="String"><span class="String">'</span>build:parser<span class="
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.9.1
|
||||
<b class="header" style="margin-top: 20px;">0.9.1
|
||||
<span class="timestamp"> – <small>Aug 11, 2010</small></span>
|
||||
</b>
|
||||
Bugfix release for <b>0.9.1</b>. Greatly improves the handling of mixed
|
||||
|
@ -1982,7 +1986,7 @@ task(<span class="String"><span class="String">'</span>build:parser<span class="
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.9.0
|
||||
<b class="header" style="margin-top: 20px;">0.9.0
|
||||
<span class="timestamp"> – <small>Aug 4, 2010</small></span>
|
||||
</b>
|
||||
The CoffeeScript <b>0.9</b> series is considered to be a release candidate
|
||||
|
@ -2008,7 +2012,7 @@ task(<span class="String"><span class="String">'</span>build:parser<span class="
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.7.2
|
||||
<b class="header" style="margin-top: 20px;">0.7.2
|
||||
<span class="timestamp"> – <small>Jul 12, 2010</small></span>
|
||||
</b>
|
||||
Quick bugfix (right after 0.7.1) for a problem that prevented <tt>coffee</tt>
|
||||
|
@ -2016,7 +2020,7 @@ task(<span class="String"><span class="String">'</span>build:parser<span class="
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.7.1
|
||||
<b class="header" style="margin-top: 20px;">0.7.1
|
||||
<span class="timestamp"> – <small>Jul 11, 2010</small></span>
|
||||
</b>
|
||||
Block-style comments are now passed through and printed as JavaScript block
|
||||
|
@ -2026,7 +2030,7 @@ task(<span class="String"><span class="String">'</span>build:parser<span class="
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.7.0
|
||||
<b class="header" style="margin-top: 20px;">0.7.0
|
||||
<span class="timestamp"> – <small>Jun 28, 2010</small></span>
|
||||
</b>
|
||||
Official CoffeeScript variable style is now camelCase, as in JavaScript.
|
||||
|
@ -2045,7 +2049,7 @@ task(<span class="String"><span class="String">'</span>build:parser<span class="
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.6.2
|
||||
<b class="header" style="margin-top: 20px;">0.6.2
|
||||
<span class="timestamp"> – <small>May 15, 2010</small></span>
|
||||
</b>
|
||||
The <tt>coffee</tt> command will now preserve directory structure when
|
||||
|
@ -2062,7 +2066,7 @@ task(<span class="String"><span class="String">'</span>build:parser<span class="
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.6.1
|
||||
<b class="header" style="margin-top: 20px;">0.6.1
|
||||
<span class="timestamp"> – <small>Apr 12, 2010</small></span>
|
||||
</b>
|
||||
Upgraded CoffeeScript for compatibility with the new Node.js <b>v0.1.90</b>
|
||||
|
@ -2070,7 +2074,7 @@ task(<span class="String"><span class="String">'</span>build:parser<span class="
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.6.0
|
||||
<b class="header" style="margin-top: 20px;">0.6.0
|
||||
<span class="timestamp"> – <small>Apr 3, 2010</small></span>
|
||||
</b>
|
||||
Trailing commas are now allowed, a-la Python. Static
|
||||
|
@ -2079,7 +2083,7 @@ task(<span class="String"><span class="String">'</span>build:parser<span class="
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.5.6
|
||||
<b class="header" style="margin-top: 20px;">0.5.6
|
||||
<span class="timestamp"> – <small>Mar 23, 2010</small></span>
|
||||
</b>
|
||||
Interpolation can now be used within regular expressions and heredocs, as well as
|
||||
|
@ -2092,7 +2096,7 @@ task(<span class="String"><span class="String">'</span>build:parser<span class="
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.5.5
|
||||
<b class="header" style="margin-top: 20px;">0.5.5
|
||||
<span class="timestamp"> – <small>Mar 8, 2010</small></span>
|
||||
</b>
|
||||
String interpolation, contributed by
|
||||
|
@ -2103,7 +2107,7 @@ task(<span class="String"><span class="String">'</span>build:parser<span class="
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.5.4
|
||||
<b class="header" style="margin-top: 20px;">0.5.4
|
||||
<span class="timestamp"> – <small>Mar 3, 2010</small></span>
|
||||
</b>
|
||||
Bugfix that corrects the Node.js global constants <tt>__filename</tt> and
|
||||
|
@ -2112,7 +2116,7 @@ task(<span class="String"><span class="String">'</span>build:parser<span class="
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.5.3
|
||||
<b class="header" style="margin-top: 20px;">0.5.3
|
||||
<span class="timestamp"> – <small>Feb 27, 2010</small></span>
|
||||
</b>
|
||||
CoffeeScript now has a syntax for defining classes. Many of the core
|
||||
|
@ -2124,7 +2128,7 @@ task(<span class="String"><span class="String">'</span>build:parser<span class="
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.5.2
|
||||
<b class="header" style="margin-top: 20px;">0.5.2
|
||||
<span class="timestamp"> – <small>Feb 25, 2010</small></span>
|
||||
</b>
|
||||
Added a compressed version of the compiler for inclusion in web pages as
|
||||
|
@ -2135,7 +2139,7 @@ task(<span class="String"><span class="String">'</span>build:parser<span class="
|
|||
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.5.1
|
||||
<b class="header" style="margin-top: 20px;">0.5.1
|
||||
<span class="timestamp"> – <small>Feb 24, 2010</small></span>
|
||||
</b>
|
||||
Improvements to null soaking with the existential operator, including
|
||||
|
@ -2145,7 +2149,7 @@ task(<span class="String"><span class="String">'</span>build:parser<span class="
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.5.0
|
||||
<b class="header" style="margin-top: 20px;">0.5.0
|
||||
<span class="timestamp"> – <small>Feb 21, 2010</small></span>
|
||||
</b>
|
||||
CoffeeScript 0.5.0 is a major release, While there are no language changes,
|
||||
|
@ -2154,7 +2158,7 @@ task(<span class="String"><span class="String">'</span>build:parser<span class="
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.3.2
|
||||
<b class="header" style="margin-top: 20px;">0.3.2
|
||||
<span class="timestamp"> – <small>Feb 8, 2010</small></span>
|
||||
</b>
|
||||
<tt>@property</tt> is now a shorthand for <tt>this.property</tt>.<br />
|
||||
|
@ -2163,7 +2167,7 @@ task(<span class="String"><span class="String">'</span>build:parser<span class="
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.3.0
|
||||
<b class="header" style="margin-top: 20px;">0.3.0
|
||||
<span class="timestamp"> – <small>Jan 26, 2010</small></span>
|
||||
</b>
|
||||
CoffeeScript 0.3 includes major syntax changes:
|
||||
|
@ -2181,7 +2185,7 @@ task(<span class="String"><span class="String">'</span>build:parser<span class="
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.2.6
|
||||
<b class="header" style="margin-top: 20px;">0.2.6
|
||||
<span class="timestamp"> – <small>Jan 17, 2010</small></span>
|
||||
</b>
|
||||
Added Python-style chained comparisons, the conditional existence
|
||||
|
@ -2191,7 +2195,7 @@ task(<span class="String"><span class="String">'</span>build:parser<span class="
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.2.5
|
||||
<b class="header" style="margin-top: 20px;">0.2.5
|
||||
<span class="timestamp"> – <small>Jan 13, 2010</small></span>
|
||||
</b>
|
||||
The conditions in switch statements can now take multiple values at once —
|
||||
|
@ -2202,7 +2206,7 @@ task(<span class="String"><span class="String">'</span>build:parser<span class="
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.2.4
|
||||
<b class="header" style="margin-top: 20px;">0.2.4
|
||||
<span class="timestamp"> – <small>Jan 12, 2010</small></span>
|
||||
</b>
|
||||
Added ECMAScript Harmony style destructuring assignment, for dealing with
|
||||
|
@ -2211,7 +2215,7 @@ task(<span class="String"><span class="String">'</span>build:parser<span class="
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.2.3
|
||||
<b class="header" style="margin-top: 20px;">0.2.3
|
||||
<span class="timestamp"> – <small>Jan 11, 2010</small></span>
|
||||
</b>
|
||||
Axed the unsatisfactory <tt>ino</tt> keyword, replacing it with <tt>of</tt> for
|
||||
|
@ -2219,7 +2223,7 @@ task(<span class="String"><span class="String">'</span>build:parser<span class="
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.2.2
|
||||
<b class="header" style="margin-top: 20px;">0.2.2
|
||||
<span class="timestamp"> – <small>Jan 10, 2010</small></span>
|
||||
</b>
|
||||
When performing a comprehension over an object, use <tt>ino</tt>, instead
|
||||
|
@ -2242,14 +2246,14 @@ task(<span class="String"><span class="String">'</span>build:parser<span class="
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.2.1
|
||||
<b class="header" style="margin-top: 20px;">0.2.1
|
||||
<span class="timestamp"> – <small>Jan 5, 2010</small></span>
|
||||
</b>
|
||||
Arguments objects are now converted into real arrays when referenced.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.2.0
|
||||
<b class="header" style="margin-top: 20px;">0.2.0
|
||||
<span class="timestamp"> – <small>Jan 5, 2010</small></span>
|
||||
</b>
|
||||
Major release. Significant whitespace. Better statement-to-expression
|
||||
|
@ -2261,7 +2265,7 @@ task(<span class="String"><span class="String">'</span>build:parser<span class="
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.1.6
|
||||
<b class="header" style="margin-top: 20px;">0.1.6
|
||||
<span class="timestamp"> – <small>Dec 27, 2009</small></span>
|
||||
</b>
|
||||
Bugfix for running <tt>coffee --interactive</tt> and <tt>--run</tt>
|
||||
|
@ -2270,7 +2274,7 @@ task(<span class="String"><span class="String">'</span>build:parser<span class="
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.1.5
|
||||
<b class="header" style="margin-top: 20px;">0.1.5
|
||||
<span class="timestamp"> – <small>Dec 26, 2009</small></span>
|
||||
</b>
|
||||
Array slice literals and array comprehensions can now both take Ruby-style
|
||||
|
@ -2281,7 +2285,7 @@ task(<span class="String"><span class="String">'</span>build:parser<span class="
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.1.4
|
||||
<b class="header" style="margin-top: 20px;">0.1.4
|
||||
<span class="timestamp"> – <small>Dec 25, 2009</small></span>
|
||||
</b>
|
||||
The official CoffeeScript extension is now <tt>.coffee</tt> instead of
|
||||
|
@ -2295,7 +2299,7 @@ task(<span class="String"><span class="String">'</span>build:parser<span class="
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.1.3
|
||||
<b class="header" style="margin-top: 20px;">0.1.3
|
||||
<span class="timestamp"> – <small>Dec 25, 2009</small></span>
|
||||
</b>
|
||||
The <tt>coffee</tt> command now includes <tt>--interactive</tt>,
|
||||
|
@ -2311,7 +2315,7 @@ task(<span class="String"><span class="String">'</span>build:parser<span class="
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.1.2
|
||||
<b class="header" style="margin-top: 20px;">0.1.2
|
||||
<span class="timestamp"> – <small>Dec 24, 2009</small></span>
|
||||
</b>
|
||||
Fixed a bug with calling <tt>super()</tt> through more than one level of
|
||||
|
@ -2325,14 +2329,14 @@ task(<span class="String"><span class="String">'</span>build:parser<span class="
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.1.1
|
||||
<b class="header" style="margin-top: 20px;">0.1.1
|
||||
<span class="timestamp"> – <small>Dec 24, 2009</small></span>
|
||||
</b>
|
||||
Added <tt>instanceof</tt> and <tt>typeof</tt> as operators.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.1.0
|
||||
<b class="header" style="margin-top: 20px;">0.1.0
|
||||
<span class="timestamp"> – <small>Dec 24, 2009</small></span>
|
||||
</b>
|
||||
Initial CoffeeScript release.
|
||||
|
|
Loading…
Reference in a new issue