I think Oliver's original formulation is more correct, but regardless this really would have to be specified using ES5 pseudo code.
This is along the path of what I was calling a "generalized" solution to the problem and as such I think it needs deeper/longer consideration to be sure we have it right. I think a single argument Array.create is safer if we are looking for something that could be immediately implemented in order to start phasing out __proto__. Having Array.create wouldn't stop also providing a more general solution such as the one below. Allen On Mar 18, 2011, at 10:56 AM, Mike Shaver wrote: > On Fri, Mar 18, 2011 at 10:45 AM, Oliver Hunt <[email protected]> wrote: >> I think so -- my proposal doesn't take instances, nor produce instances, it >> takes the constructor function (Image is one of a handful of DOM constructor >> that can actually be used to construct things) and returns a new constructor >> that will produce an instances of the target object with a modified >> prototype chain. > > Andreas in IM that we hang it on the prototype chain, so that we get > it everywhere without repetitive specification. How about: > > Function.prototype.createDelegatingTo = function (obj) > { > var o = new this; // really new-with-apply(arguments) here > o.__proto__ = obj; > return o; > } > > Then Array.createDelegatingTo, Boolean.createDelegatingTo, Image, etc. > should all work. (I like the longer, grosser name because I think > it's sort of a gross pattern, and not something that should use up a > concise name.) > > Mike > _______________________________________________ > es-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es-discuss _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

