Outline of exactly how @@create works?

Allen Wirfs-Brock allen at wirfs-brock.com
Wed Aug 7 15:02:37 PDT 2013

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.


More information about the es-discuss mailing list