(sorry for limitations of terrible tablet mailer)
Also, in general this sort of well known private method name hook is much more
extensible than "internal method" as currently used in the es spec. They also
avoid the need to polute the Proxy API
Allen
Sent from Samsung tabletBrendan Eich <[email protected]> wrote:On Oct 21,
2011, at 11:49 AM, John J Barton wrote:
On Fri, Oct 21, 2011 at 9:36 AM, Axel Rauschmayer <[email protected]> wrote:
In a vein similar to making [] available to collections, one could make "new"
and "instanceof" available to other inheritance schemes.
For example:
// “Meta-class” for prototypes as classes/instantiable prototypes
function ProtoExemplars() {}
ProtoExamplar.prototype.{
operatorNew(...args) {
let inst = Object.create(this);
return inst.constructor(...args);
},
operatorInstanceof(lhs) {
return this.isPrototypeOf(lhs);
}
};
More entirely unsubstantiated personal opinion based on a few days experience:
Gonzala's https://github.com/Gozala/selfish does this now and with nicer
syntax.
That is nice, but it seems to me Axel was aiming to make the new and instanceof
operators useful. If you don't care about those operators, Irakli's library is
great.
One subtle point I missed about his approach: instance (member) variables are
created in initializers, not as literals, unless you intend to make the
variable part of a prototype. This could be stumbling block for Java converts,
who expect declarative members.
Java-heads may expect new and instanceof too, for that matter.
y bump so far: XMLHttpRequest.apply fails and you can't run
XMLHttpRequest.prototype.addEventListener unless you run XMLHttpRequest() on
the object. So I could not figure out how to inherit from XMLHttpRequest.
This seems like an XHR bug. Mail public-script-coord?
/be_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss