github at esdiscuss.org (2013-07-12T02:26:55.516Z)
Feedback based on http://wiki.ecmascript.org/doku.php?id=strawman:relationships
Curiosity question: What do "geti" and "seti" refer to? (the `i` specifically)
Is it necessary for r to be able to be a string or a symbol? It looks superflous, but maybe there is a good reason.
In the `[[GetRelationship]]` algorithm, `if r.[[Get]](@geti) is undefined, then return x.[[Get]](r)` but what is this supposed to do if r is an object? `x[r]` would coerce `r` to a `String` before passing it to `[[Get]]`, but here the object is passed directly without coercion. I feel this question is answered step 5.I of interaction with proxies which talks about stringification.
I wonder if implicit stringification is necessary. I'm afraid most of the time, it'll mean `"[Object object]"` will be passed as key and result in an unexpected behavior (collision of keys, etc.) I would be in favor to either do nothing or throw when `r.[[Get]](@geti)/r.[[Get]](@seti)` is `undefined`. In any case, devtools can show a warning saying that `r` didn't have a `@geti` or `@seti` property if necessary.
That the private "fields" make a relationship only to a value and don't follow the property descriptor path is a good feature. The idea of using `Object.getOwnPropertyDescriptor` on private symbols has a bad taste to it.
It's not written in the strawman explicitly, but if this proposal is in, all the whitelist/unknownPrivateSymbol trap mess is going away. Probably for the best :-)
It's taking me some time to understand the Map/WeakMap behavior. Sharing my understanding step by step:
```js
var o = {};
var wm = new WeakMap();
wm.set(o, 12);
wm.get(o);
WeakMap.prototype.set === WeakMap.prototype[@seti]
```
So `wm.set(o, 12);` is equivalent to `o at wm = 12` and `o at wm` is equivalent to `wm.get(o, 12)`, unless `o` isn't a key in which case `o.[[Prototype]]` is attempted. I don't understand the need to climb the prototype chain of the key. Hmm... It's true that in `o.azerty`, `'azerty'` is looked up on `o`, then its prototype, then its prototype, etc.
Nits: no need to declare `this` as argument of `[[(Weak)MapGetInherited]]`. Also, maybe you want to use the ES6 included
`[[GetPrototype]]` instead of `[[Prototype]]` (I'm not sure about this one).
Are there default `@geti`/`@seti` for `Object.prototype`?
Hi, Feedback based on http://wiki.ecmascript.org/doku.php?id=strawman:relationships Curiosity question: What do "geti" and "seti" refer to? (the 'i' specifically) Is it necessary for r to be able to be a string or a symbol? It looks superflous, but maybe there is a good reason. In the [[GetRelationship]] algorithm, if r.[[Get]](@geti) is undefined, then return x.[[Get]](r) but what is this supposed to do if r is an object? x[r] would coerce r to a String before passing it to [[Get]], but here the object is passed directly without coercion. I feel this question is answered step 5.I of interaction with proxies which talks about stringification. I wonder if implicit stringification is necessary. I'm afraid most of the time, it'll mean "[Object object]" will be passed as key and result in an unexpected behavior (collision of keys, etc.) I would be in favor to either do nothing or throw when r.[[Get]](@geti)/r.[[Get]](@seti) is undefined. In any case, devtools can show a warning saying that r didn't have a @geti or @seti property if necessary. That the private "fields" make a relationship only to a value and don't follow the property descriptor path is a good feature. The idea of using Object.getOwnPropertyDescriptor on private symbols has a bad taste to it. It's not written in the strawman explicitly, but if this proposal is in, all the whitelist/unknownPrivateSymbol trap mess is going away. Probably for the best :-) It's taking me some time to understand the Map/WeakMap behavior. Sharing my understanding step by step: var o = {}; var wm = new WeakMap(); wm.set(o, 12); wm.get(o); WeakMap.prototype.set === WeakMap.prototype[@seti] So wm.set(o, 12); is equivalent to "o at wm = 12" And "o at wm" is equivalent to "wm.get(o, 12)", unless o isn't a key in which case o.[[Prototype]] is attempted. I don't understand the need to climb the prototype chain of the key. Hmm... It's true that in "o.azerty", 'azerty' is looked up on o, then its prototype, then its prototype, etc. Nits: no need to declare 'this' as argument of [[(Weak)MapGetInherited]]. Also, maybe you want to use the ES6 included [[GetPrototype]] instead of [[Prototype]] (I'm not sure about this one). Are there default @geti/@seti for Object.prototype? David