Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save textgoeshere/959446 to your computer and use it in GitHub Desktop.
Save textgoeshere/959446 to your computer and use it in GitHub Desktop.
coffeescript compilation order weirdness
class window.SpreadsController extends Backbone.Controller
routes:
"/sports":"sports"
"/markets":"markets"
constructor: ->
super
window.sport_manager = new SportManagerView()
// ubuntu 10.10
// node v0.5.0-pre
// coffeescript 1.1.0
(function() {
var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
};
window.SpreadsController = (function() {
SpreadsController.prototype.routes = {
"/sports": "sports",
"/markets": "markets"
};
__extends(SpreadsController, Backbone.Controller); ////////////////// __extends AFTER routes, BROKEN
function SpreadsController() {
SpreadsController.__super__.constructor.apply(this, arguments);
window.market_manager = new MarketManagerView();
window.sport_manager = new SportManagerView();
}
return SpreadsController;
})();
}).call(this);
// ubuntu 10.10
// node v0.5.0-pre
// coffeescript 1.1.0
(function() {
var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
};
window.SpreadsController = (function() {
__extends(SpreadsController, Backbone.Controller); ///////////////// DIFFERENT ORDER, WORKING ROUTES
SpreadsController.prototype.routes = {
"/sports": "sports",
"/markets": "markets"
};
function SpreadsController() {
SpreadsController.__super__.constructor.apply(this, arguments);
window.market_manager = new MarketManagerView();
window.sport_manager = new SportManagerView();
}
return SpreadsController;
})();
}).call(this);
@TrevorBurnham
Copy link

Mystery solved: #1 is the output from CoffeeScript 1.1.0; #2 is the output from the current master branch, which erroneously calls itself 1.1.0. So, the fix from #2 will be part of 1.1.1, which should be released soon.

@textgoeshere
Copy link
Author

Brilliant, cheers Trevor, thanks for taking the time to clear that up for me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment