Andrea Giammarchi wrote:
__Current Status__

(Thanks for the dunders! :-P)

Instead of formalizing its form, ES6 accepted `Object.setPrototypeOf` as described in specs and decided to silently move beside, but still have in specs, the dunder `__proto__` form, fixing at least a couple of related gotchas so that:

* unless explicitly set as property, `__proto__` is a named property for every object that should not affect inheritance so that `obj["__proto__"]` or `obj[key]` where `key` is the string `"__proto__"` should not hot/swap the prototypal chain

I'm not sure what you mean here, but first, __proto__ is not specified in ES6 drafts as an own property. See

http://people.mozilla.org/~jorendorff/es6-draft.html#sec-B.2.2.1


 B.2.2.1
 
<http://people.mozilla.org/%7Ejorendorff/es6-draft.html#sec-object.prototype.__proto__>
 Object.prototype.__proto__

Object.prototype.__proto__ is an accessor property with attributes { [[Enumerable]]: false, [[Configurable]]: true }. The [[Get]] and [[Set]] attributes are defined as follows


 B.2.2.1.1
 
<http://people.mozilla.org/%7Ejorendorff/es6-draft.html#sec-get-object.prototype.__proto__>
 get Object.prototype.__proto__

The value of the [[Get]] attribute is a built-in function that requires no arguments. It performs the following steps:

1. Let /O/ be the result of calling ToObject
   <http://people.mozilla.org/%7Ejorendorff/es6-draft.html#sec-toobject> passing
   the *this* value as the argument.
2. ReturnIfAbrupt
   
<http://people.mozilla.org/%7Ejorendorff/es6-draft.html#sec-returnifabrupt>(/O/).
3. Return the result of calling the [[GetPrototypeOf]] internal method
   of /O/.


 B.2.2.1.2
 
<http://people.mozilla.org/%7Ejorendorff/es6-draft.html#sec-set-object.prototype.__proto__>
 set Object.prototype.__proto__

The value of the [[Set]] attribute is a built-in function that takes an argument proto. It performs the following steps:

1. Let /O/ be CheckObjectCoercible
   
<http://people.mozilla.org/%7Ejorendorff/es6-draft.html#sec-checkobjectcoercible>(*this*
   value)/./
2. ReturnIfAbrupt
   
<http://people.mozilla.org/%7Ejorendorff/es6-draft.html#sec-returnifabrupt>(/O/).
3. If Type
   
<http://people.mozilla.org/%7Ejorendorff/es6-draft.html#sec-ecmascript-data-types-and-values>(/proto/)
   is neither Object or Null, then return /proto/.
4. If Type
   
<http://people.mozilla.org/%7Ejorendorff/es6-draft.html#sec-ecmascript-data-types-and-values>(/O)/
   is not Object, then return /proto/.
5. Let /status/ be the result of calling the [[SetPrototypeOf]]
   internal method of /O/ with argument /proto/.
6. ReturnIfAbrupt
   
<http://people.mozilla.org/%7Ejorendorff/es6-draft.html#sec-returnifabrupt>(/status/).
7. If /status/ is *false*, then throw a *TypeError* exception.
8. Return /proto/.



/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to