You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@tvcutsem, would you have a reference on the rationale for the behavior of Reflect.set? I can understand the specs, but it's nonetheless surprising. Thanks in advance!
Reflect.set is quite intuitive.
g={foo: 'A'};e={foo: 'B'};console.log(Reflect.get(e,'foo',g));// 'B' <= as we expect, value came from "e"
However, Reflect.set is surprising.
Reflect.set(e,'foo','X',g);console.log(g.foo,e.foo)// 'X', 'B' <= surprise, data property was set on "g"
This also seems to confuse others:
I guess it's just confusing that Reflect.get reads from the target, while Reflect.set writes to the receiver.
@tvcutsem, would you have a reference on the rationale for the behavior of Reflect.set? I can understand the specs, but it's nonetheless surprising. Thanks in advance!
Reflect.set is quite intuitive.
However, Reflect.set is surprising.
This also seems to confuse others:
https://stackoverflow.com/questions/47992070/reflect-set-not-working-as-intended
The text was updated successfully, but these errors were encountered: