duktape: [Q] Proxy enumeration problem
(let me know if I should rather ask on Stackoverflow)
Almost done with the proxy I have a last thing left: enumeration. For code like:
for (var arg in arguments)
print(arg);
I get no output, even though my ownKeys
code is called and returns the array indices. Someone mentioned the returned list is filtered against the list of keys in the target object (like an intersection). What’s the correct way to make enumeration working?
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 18 (12 by maintainers)
There are several places where property attributes of a property are queried internally, so it’s not limited to enumeration only. I could add the trap initially for enumeration only, to fix this particular limitation, and then figure out what changes are needed for all the remaining call sites. But we’ll see, I’ll check what’s needed when I get the chance 😃
The
__proto__
property is the “internal” prototype of the object and is an inherited getter. There’s also an artificial debugger property which provides the value without a getter call.I find these constraints interesting (and maybe a little frustrating), because people–including some involved in TC39–are always harping on how a Proxy object should always have final say wherever one is involved. Having constraints that are validated directly against the target object seems to contradict that goal.
@mike-lischke I’m a bit busy right now but I’ll get back later today.