@@create allows you to set up instance prototypes, here's an amended version of your example code using ES6 classes: https://gist.github.com/anba/9f0acbb29bf755d26f37

The updated version also gets rid of the "origProto" workaround, but requires a custom @@hasInstance hook. I've tested the script with [1], not sure if the other ES6 runtimes/transpilers already provide support for @@create and @@hasInstance.


- André

[1] https://github.com/anba/es6draft

Thanks to proxies now having a separate trap for "invoke", we can automatically bind 
methods on "get". I've written down my thoughts here:
http://www.2ality.com/2013/06/auto-binding.html

Axel

--
Dr. Axel Rauschmayer
axel at rauschma.de  <https://mail.mozilla.org/listinfo/es-discuss>

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