diff --git a/coffee-script.gemspec b/coffee-script.gemspec index ebf191b6..b1114071 100644 --- a/coffee-script.gemspec +++ b/coffee-script.gemspec @@ -1,7 +1,7 @@ Gem::Specification.new do |s| s.name = 'coffee-script' - s.version = '0.2.1' # Keep version in sync with coffee-script.rb - s.date = '2010-1-5' + s.version = '0.2.2' # Keep version in sync with coffee-script.rb + s.date = '2010-1-10' s.homepage = "http://jashkenas.github.com/coffee-script/" s.summary = "The CoffeeScript Compiler" diff --git a/documentation/coffee/object_comprehensions.coffee b/documentation/coffee/object_comprehensions.coffee deleted file mode 100644 index 8b637082..00000000 --- a/documentation/coffee/object_comprehensions.coffee +++ /dev/null @@ -1,3 +0,0 @@ -years_old: {max: 10, ida: 9, tim: 11} - -ages: child + " is " + age for age, child in years_old \ No newline at end of file diff --git a/documentation/index.html.erb b/documentation/index.html.erb index 9a927bf3..d50bc725 100644 --- a/documentation/index.html.erb +++ b/documentation/index.html.erb @@ -51,7 +51,7 @@
Latest Version: - 0.2.1 + 0.2.2
You can use newlines to break up your expression into smaller pieces, - as long as CoffeeScript can tell that the line hasn't finished + as long as CoffeeScript can tell that the line hasn't finished (similar to how Ruby handles it). For example, if the line ends in an operator, dot, or keyword.
@@ -571,6 +571,17 @@ coffee --print app/scripts/*.coffee > concatenation.js+ 0.2.2 + The "splat" symbol has been changed from a prefix asterisk *, to + a postfix ellipsis .... Added JavaScript's in operator, + empty return statements, and empty while loops. + Constructor functions that start with capital letters now include a + safety check to make sure that the new instance of the object is returned. + The extends keyword now functions identically to goog.inherits + in Google's Closure Library. +
+0.2.1 Arguments objects are now converted into real arrays when referenced. diff --git a/documentation/js/array_comprehensions.js b/documentation/js/array_comprehensions.js index 089b9fcf..c6557905 100644 --- a/documentation/js/array_comprehensions.js +++ b/documentation/js/array_comprehensions.js @@ -1,32 +1,24 @@ (function(){ - var __a, __b, __c, __d, __e, __f, __g, __h, __i, __j, food, lunch, roid, roid2; + var __a, __b, __c, __d, __e, __f, __g, lunch; // Eat lunch. lunch = (function() { - __a = ['toast', 'cheese', 'wine']; - __c = []; - for (__b in __a) { - if (__a.hasOwnProperty(__b)) { - food = __a[__b]; - __d = eat(food); - __c.push(__d); - } + __c = []; __a = ['toast', 'cheese', 'wine']; + for (__b=0; __b<__a.length; __b++) { + food = __a[__b]; + __c.push(eat(food)); } return __c; })(); // Naive collision detection. - __e = asteroids; - for (__f in __e) { - if (__e.hasOwnProperty(__f)) { - roid = __e[__f]; - __h = asteroids; - for (__i in __h) { - if (__h.hasOwnProperty(__i)) { - roid2 = __h[__i]; - if (roid !== roid2) { - if (roid.overlaps(roid2)) { - roid.explode(); - } - } + __d = asteroids; + for (__e=0; __e<__d.length; __e++) { + roid = __d[__e]; + __f = asteroids; + for (__g=0; __g<__f.length; __g++) { + roid2 = __f[__g]; + if (roid !== roid2) { + if (roid.overlaps(roid2)) { + roid.explode(); } } } diff --git a/documentation/js/expressions_comprehension.js b/documentation/js/expressions_comprehension.js index 5dea5cf0..7cdcbe7e 100644 --- a/documentation/js/expressions_comprehension.js +++ b/documentation/js/expressions_comprehension.js @@ -1,15 +1,11 @@ (function(){ - var __a, __b, __c, globals, name, property; + var __a, __b, globals, name; // The first ten global properties. globals = ((function() { - __a = window; - __b = []; - for (name in __a) { - if (__a.hasOwnProperty(name)) { - property = __a[name]; - __c = name; - __b.push(__c); - } + __b = []; __a = window; + for (name=0; name<__a.length; name++) { + property = __a[name]; + __b.push(name); } return __b; })()).slice(0, 10); diff --git a/documentation/js/object_comprehensions.js b/documentation/js/object_comprehensions.js deleted file mode 100644 index 757ad863..00000000 --- a/documentation/js/object_comprehensions.js +++ /dev/null @@ -1,20 +0,0 @@ -(function(){ - var __a, __b, __c, age, ages, child, years_old; - years_old = { - max: 10, - ida: 9, - tim: 11 - }; - ages = (function() { - __a = years_old; - __b = []; - for (child in __a) { - if (__a.hasOwnProperty(child)) { - age = __a[child]; - __c = child + " is " + age; - __b.push(__c); - } - } - return __b; - })(); -})(); \ No newline at end of file diff --git a/documentation/js/overview.js b/documentation/js/overview.js index e3832187..cdb3d0a0 100644 --- a/documentation/js/overview.js +++ b/documentation/js/overview.js @@ -1,5 +1,5 @@ (function(){ - var __a, __b, __c, __d, cubed_list, list, math, num, number, opposite_day, race, square; + var __a, __b, __c, cubed_list, list, math, number, opposite_day, race, square; // Assignment: number = 42; opposite_day = true; @@ -33,14 +33,10 @@ } // Array comprehensions: cubed_list = (function() { - __a = list; - __c = []; - for (__b in __a) { - if (__a.hasOwnProperty(__b)) { - num = __a[__b]; - __d = math.cube(num); - __c.push(__d); - } + __c = []; __a = list; + for (__b=0; __b<__a.length; __b++) { + num = __a[__b]; + __c.push(math.cube(num)); } return __c; })(); diff --git a/documentation/js/range_comprehensions.js b/documentation/js/range_comprehensions.js index 7457b7f4..c2563558 100644 --- a/documentation/js/range_comprehensions.js +++ b/documentation/js/range_comprehensions.js @@ -1,8 +1,7 @@ (function(){ - var __a, __b, __c, __d, __e, dozen_eggs, i; - __d = 0; - __e = eggs.length; - for (__c=0, i=__d; (__d <= __e ? i < __e : i > __e); (__d <= __e ? i += 12 : i -= 12), __c++) { + var __a, __b, __c, __d, dozen_eggs; + __c = 0; __d = eggs.length; + for (__b=0, i=__c; (__c <= __d ? i < __d : i > __d); (__c <= __d ? i += 12 : i -= 12), __b++) { dozen_eggs = eggs.slice(i, i + 12); deliver(new egg_carton(dozen)); } diff --git a/documentation/js/super.js b/documentation/js/super.js index dc6e099a..4bc9b92d 100644 --- a/documentation/js/super.js +++ b/documentation/js/super.js @@ -1,5 +1,5 @@ (function(){ - var Animal, Horse, Snake, sam, tom; + var Animal, Horse, Snake, __a, __b, sam, tom; Animal = function Animal() { }; Animal.prototype.move = function move(meters) { @@ -10,20 +10,24 @@ __a = this.name = name; return Snake === this.constructor ? this : __a; }; + __a = function(){}; + __a.prototype = Animal.prototype; Snake.__superClass__ = Animal.prototype; - Snake.prototype = new Animal(); + Snake.prototype = new __a(); Snake.prototype.constructor = Snake; Snake.prototype.move = function move() { alert("Slithering..."); return Snake.__superClass__.move.call(this, 5); }; Horse = function Horse(name) { - var __a; - __a = this.name = name; - return Horse === this.constructor ? this : __a; + var __b; + __b = this.name = name; + return Horse === this.constructor ? this : __b; }; + __b = function(){}; + __b.prototype = Animal.prototype; Horse.__superClass__ = Animal.prototype; - Horse.prototype = new Animal(); + Horse.prototype = new __b(); Horse.prototype.constructor = Horse; Horse.prototype.move = function move() { alert("Galloping..."); diff --git a/index.html b/index.html index d1c3b168..fe1bbc09 100644 --- a/index.html +++ b/index.html @@ -37,7 +37,7 @@
Latest Version: - 0.2.1 + 0.2.2
var __a, __b, __c, __d, cubed_list, list, math, num, number, opposite_day, race, square;
+
var __a, __b, __c, cubed_list, list, math, number, opposite_day, race, square; // Assignment: number = 42; opposite_day = true; @@ -137,18 +137,14 @@ race = function // Array comprehensions: cubed_list = (function() { - __a = list; - __c = []; - for (__b in __a) { - if (__a.hasOwnProperty(__b)) { - num = __a[__b]; - __d = math.cube(num); - __c.push(__d); - } + __c = []; __a = list; + for (__b=0; __b<__a.length; __b++) { + num = __a[__b]; + __c.push(math.cube(num)); } return __c; })(); -