ES3.1 Object static methods rationale document

Igor Bukanov igor at
Fri Jul 18 08:15:01 PDT 2008

2008/7/18 Allen Wirfs-Brock <Allen.Wirfs-Brock at>:
> Collectively, getOwnProperty,defineProperties/defineProperty,getOwnPropertyNames,getPrototypeOf are intended to provide all the mechanisms necessary to build any of these variants to extent or any other model of property manipulation using whatever policies for property selection that might be desired by the designer.

This suggests to have a convenience method like getOwnProperties that
return an array of ptoperty descriptor for the object. It would allow
a user to define a simple form of the extend method as:

  Object.defineProperties(destination, Object.getOwnProperties(source));

It would also allow to define Object.clone(source) precisely as

  Object.create(Object.getPrototypeOf(source), Object.getOwnProperties(source));

Which in fact shows that Object.clone is in the same category as
Object.extend. Both methods defines very particular arrangement of
properties in the object and less fundamental than the rest sets of
the methods.

Regards, Igor

More information about the Es4-discuss mailing list