ES3.1 Object static methods rationale document

Garrett Smith dhtmlkitchen at gmail.com
Fri Jul 18 14:29:11 PDT 2008


On Fri, Jul 18, 2008 at 12:40 PM, John Resig <jresig at mozilla.com> wrote:
>
>> You're prev response seems to have come from the discussion of
>> Object.create.
>
> No? We've been discussing the viability of a new Object.extend() method to be introduced in ES3.1.

The title of the thread is "object static methods rationale doc" and
the first post has a link to the doc.

The first mention of I see of "extend" was by Brendan, who merely
asked: "Did you consider prototype's Object.extend method."

To which Doug replied: "Yes we did."
And Allen later replied: "As far as I can recall, we didn't discuss a
specific formulation that corresponds to Object.extend"


> Mozilla has offered a proposal and is looking to implement it in SpiderMonkey.

I see a bug report for that mentioned in the thread.

"Object.extend" seems to be a misnomer for augmenting objects. It
might contrast with Prototype.js Object.extend. "augment" or "mixin"
or even "flatten" would do the trick.

/**
 * Object.create
 * @description Creates a new object based on \
 * subject with propertyDescriptor as the [[Prototype]]
 * @param subject
 * @param {PropertyDescriptor} propertyDescriptor
 * properties with attributes for A's prototype
 */

1) Object.create doesn't modify subject/receiver, extend does
2) Object.create takes objects, extend takes 2 functions + 1 object descriptor

>
> The aforementioned Object.create and YAHOO.lang.extend are a completely separate utilities which should be judged on their own merits.

And as I type this, I see now a new message from Allen: "I thought
that we were generally discussing how Object.extent related to the
Object meta functions that are already in the 3.1 draft."

That is what I though, too.

Garrett

>
> --John
>



More information about the Es4-discuss mailing list