Closed yorkie closed 4 years ago
If a well-known Symbol
method ends up being used, I’d guess it would call the get
trap to get the value of the method, then call it with the slice info.
@j-f1 do you have any example here? IMO the issue is how to resolve the arguments conflict of get
trap on the proxy object o[x:y:z]
.
@yorkie you're assuming that slice notation would be a new kind of complex Get. @j-f1 is saying it could be a Get of a Symbol.slice
function, which is then invoked - which would not require any changes in Proxy.
Thank you @ljharb, it resolves the problem eventually, and the slice notation is not going to get object property, the intention of the Proxy get
handler at MDN:
The handler.get() method is a trap for getting a property value.
The Proxy's
get
trap handler would deal with the followings:a.b
property accessor.a[b]
item accessor.Does this mean that the slice syntax will be merged into 2nd, the item accessor? If yes, we have to extend the handler arguments, because it's 3 at most as:
(Actually Proxy/ES doesn't have distinct declaration about the above 2 accessors, it makes developers confused a bit, and hard to extend for special item accessor like slice notation).