On Fri, Jul 18, 2008 at 10:56 AM, John Resig <[EMAIL PROTECTED]> wrote: > >> Not true. YAHOO.lang.extend uses prototypal inheritance. > > YAHOO.lang.extend is similar in name only - YAHOO.lang.augmentObject is the > one that's actually similar to the functionality used by other code bases. >
You're prev response seems to have come from the discussion of Object.create. Object.create, with only one argument, is the same as beget. The beget function makes a new object that inherits members from an existing object. The rationale doc fails to make mention of this. Is YAHOO.lang.extend(Sub, Sup, extras) less similar in functionality to object.create(sub, super) than the other augmentation rountines? I think it's worth a look. s = new Sub; s -> [[Prototype]] => Sub.prototype s -> [Prototype]] [[Prototype]] Super.prototype Object.create from "rationale doc" Function 'getPropertyDescriptorObject' would be a fictitious method that is somehow able to get all of the properties in Sup.prototype (even the DontEnum ones), and convert that into an object that matches the "propertyDescriptor" here. Object.create(Sub.prototype, getPropertyDescriptorObject(Sup.prototype)); s = new Sub; s -> [[Prototype]] => Sub.prototype s -> [Prototype]] [[Prototype]] Super.prototype YAHOO.lang.extend seems more closely related to Object.create than any of all of the rest of the code you (John) posted up; particularly the real version of first one (jQuery):- http://jqueryjs.googlecode.com/svn/trunk/jquery/src/core.js Garrett > --John > _______________________________________________ Es4-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es4-discuss
