ES3.1 Object static methods rationale document

Garrett Smith dhtmlkitchen at gmail.com
Fri Jul 18 18:21:15 PDT 2008


On Fri, Jul 18, 2008 at 2:02 PM, Allen Wirfs-Brock
<Allen.Wirfs-Brock at microsoft.com> wrote:
>> -----Original Message-----
>> From: es4-discuss-bounces at mozilla.org [mailto:es4-discuss-
>> bounces at mozilla.org] On Behalf Of Garrett Smith
>> Sent: Friday, July 18, 2008 12:28 PM
> ...
>> 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.
>
> See the first complete paragraph on page 13
>
"Note that Object.create without its optional second argument is
essentially the same operation as
the beget function that was been widely promoted. We (perhaps not
surprisingly) agree with the
utility of this function but felt that the word "beget" is probably
confusing to many non-native English
speakers."

Does object.create add an object to the first argument's prototype
chain? That's not explicitly stated, and one has to hunt down Doug's
begetObject. (below)

Does the propertyDescriptor describe an object added to the front of
the object's prototype chain?

=========================================================
Object.prototype.begetObject = function () {
    function F() {}
    F.prototype = this;
    return new F();
};

Lasse Reichstein Nielsen's "clone" function, c. 2003:-
Object.prototype.clone = function () {
    function myConstructor = function(){};
    myConstructor.prototype = this;
    return new myConstructor();
 }
=========================================================
http://groups.google.com/group/comp.lang.javascript/browse_thread/thread/0c1cc7f1cb314f8e/5d06e72e55d5bf11?#5d06e72e55d5bf11

Garrett



More information about the Es4-discuss mailing list