Allen Wirfs-Brock (2013-05-08T17:17:00.000Z)
github at esdiscuss.org (2013-07-12T02:27:20.657Z)
On May 8, 2013, at 8:46 AM, Andreas Rossberg wrote: > Isn't `Object.create` the proper alternative to both `{__proto__: }` and > triangle for objects? What has `setPrototypeOf` got to do with it? (And > why is that on the table all of a sudden?) I think that Brandon Benvie adequated addressed `Object.create`. Regarding `setPrototypeOf`, once Mark agreed that the [[protoSetter]] function did not need to be Realm restricted it essentially became a publicly available API for modify the [[Prototype]] of arbitrary objects. ```js Object.getOwnPropertyDescriptor(Object.prototype, "__proto__").set.call(obj, proto) ``` There is a vocal part of the JS community who would prefer that the core language also offer `Object.setPrototypeOf` as the preferred alternative to the above: ```js Object.setPrototypeOf(obj,proto) ``` This is only a cosmetic difference. But I agree that it is good cosmetics. Dynamic prototype modification seems to have won as a required feature of the language. Since that is the case, consistancy suggests that we should treat it cosmetically just like all the dynamic reflection operations defined on Object.