> super Foo.bar(x) should desugar to Foo.prototype.bar.call(this, x)

http://wiki.ecmascript.org/doku.php?id=harmony:object_initialiser_super

What is that you don’t like about Allen’s proposal? You are still hard-coding 
the name of the super-constructor (which is what `super` nicely avoids).

> If people make constructors of the type that are designed to be called
> with new then it works for constructors too.
> 
> // Works with super, used with var foo = new Foo.prototype.constructor()
> constructor: function() {
>  this.x = 0;
>  this.y = 0;
> }
> 
> // Doesn't work with super, used with var foo = Foo.prototype.constructor()
> constructor: function() {
>  return {x: 0, y: 0}
> }
> 
> // Also doesn't work with super
> constructor: function() {
>  var self = factory();
>  self.x = 0;
>  self.y = 0;
>  return self;
> }


I don’t understand. Are you really pointing out something that will cause 
difficulty with your proposal or a general problem?

-- 
Dr. Axel Rauschmayer
a...@rauschma.de

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com



_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to