Approach of new Object methods in ES5

Tom Van Cutsem tomvc at
Mon Apr 19 16:31:23 PDT 2010

> The problem is just that parts of the ES5 Object API is useful outside of
> meta programming and for everyday use we need syntactic sugar or a better
> API. Passing a map of property descriptors to Object.create might be
> convenient for meta programming but for everyday programming it adds a lot
> of extra useless cruft.

I agree. This frustration of the property descriptors 'getting in the way'
in part shaped the design of our traits library: the Trait
constructor<>transforms a record into
a property descriptor map, enabling you to use
methods like Object.create without having to spell out a property descriptor
map. The library also defines a method "Object.getOwnProperties" that will
perform this transformation without trait semantics. But I'm aware of the
fact that this is not really a solution to the problem you are addressing.
It's still a painfully long name, and awkward to use if all you want to do
is to create an object with a particular prototype.

My guess is that the committee would rather standardize a minimal, powerful
API, delegating the task of defining the convenience functions to library
writers. That opens up the possibility of experimentation with different
designs. Perhaps people are upset with this API because these convenience
functions have not yet been developed, let alone become widespread.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list