The class operator: a bridge between object and function exemplers

Allen Wirfs-Brock allen at wirfs-brock.com
Thu Nov 17 16:10:29 PST 2011


On Nov 17, 2011, at 3:47 PM, Jake Verbaten wrote:

> On Thu, Nov 17, 2011 at 11:39 PM, Brendan Eich <brendan at mozilla.com> wrote:
> On Nov 17, 2011, at 3:31 PM, Allen Wirfs-Brock wrote:
> 
> > We can debate whether Default Constructors should do a:
> >     if (super.constructor isnt Object) super.constructor()
> > but that is a more basic question about whether constructors (default or otherwise) should always do implicit super calls.
> 
> We should debate. What do you think?
> 
> Personally I cannot think of any examples where this functionality would be unwanted.
> 
> This debate will probably depend on the counter examples where invoking the super constructor implicitly is unwanted behavior.
> 
> An argument for doing this is that you can use initialize or some other name for constructor like functions that don't implicitly make super calls.

In general, you don't want a constructor to automatically do 
    super.constructor(...args) because a "sub-exemplar" may use a different argument signature from its "super-exemplar".

For this reason, my first reaction was:  If we don't (and we shouldn't) do an implicit super.constructor(...args) call for things like:
  {constructor() {} }
then we also should not do it for the [[DefaultConstructor]] created for { }.    However, I think I'm wavering.  The programmer hasn't actually written any code so there isn't a "different argument signature" to worry about. so, may it would be ok to do a not to Object super.constructor call.

Allen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20111117/2464f381/attachment.html>


More information about the es-discuss mailing list