W3C home > Mailing lists > Public > public-script-coord@w3.org > July to September 2013

Re: Outline of exactly how @@create works?

From: Allen Wirfs-Brock <allen@wirfs-brock.com>
Date: Wed, 7 Aug 2013 15:02:37 -0700
Cc: Domenic Denicola <domenic@domenicdenicola.com>, Boris Zbarsky <bzbarsky@mit.edu>, "es-discuss@mozilla.org" <es-discuss@mozilla.org>, "public-script-coord@w3.org" <public-script-coord@w3.org>, Travis Leithead <travis.leithead@microsoft.com>
Message-Id: <A78CB4F9-9584-4C44-9F7E-E27E129B0131@wirfs-brock.com>
To: Allen Wirfs-Brock <allen@wirfs-brock.com>

On Aug 7, 2013, at 2:41 PM, Allen Wirfs-Brock wrote:

> 
> 
> A constructor that returns a proxy is probably the most common example of the exotic object use case:
> 
> class MyExotic {
>   static [@@create] () {return new Proxy({  }, myHandler)}
>   constructor (...args) {
>         //initialize this value using args
>    }
> }

actually the @@create should mroe likely bebe

   static [@@create]() {return new Proxy(Object.create(this.prototype), myHandler)}

One of the responsibilities of a @@create method is to setup the prototype inheritance chain of the new object.

Allen
Received on Wednesday, 7 August 2013 22:03:15 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:37:50 UTC