coffeescript
coffeescript copied to clipboard
Quick access to prototype in "this" context and calling any super methods
Hello! I want to offer a shorter record for prototype access in "this" context
Animal@say 'gaf!' instead of Animal::say.call this, 'gaf!', which compiles to
Animal.prototype.say.call(this, 'gaf!');
Moreover sometimes I need to call method of superclass, not related to the current function.
So inside method of subclass, super@say 'gaf!' - can be compiled to
Animal.prototype.say.call(this, 'gaf!');
where Animal is superclass
See previous tickets -- we try to avoid adding too much sugar around call and apply, as they're already very usable APIs for setting the context of a function. The assumption that you'd want to reference the .prototype in this suggestion is problematic.