On 20.12.2011 17:00, Tom Van Cutsem wrote:
- @Tom: Found bugs in DirectProxies.js
Thanks for reporting, but I don't think these are bugs:
1. Properties created via assignment gets `false' value for
descriptor attributes; should be true. E.g. foo.bar = 10, where
`foo' is direct proxy, makes bar non-configurable
I can't reproduce this. Both in tracemonkey and ff8 I get the following:
js> var t = {}
js> var p = Proxy(t, {})
js> p.x = 1
1
js> Object.getOwnPropertyDescriptor(t, 'x')
({value:1, writable:true, enumerable:true, configurable:true})
js> Object.getOwnPropertyDescriptor(p, 'x')
({value:1, writable:true, enumerable:true, configurable:true})
There is, however, a TM-specific bug that I suspect may be the cause
of your observed "non-configurable by default" behavior:
<https://bugzilla.mozilla.org/show_bug.cgi?id=601329>
Hm, I can't reproduce it either now (latest release Firefox, WinXP).
Perhaps it was really the bug you noticed with my Firefox at work.
2. Can't return descriptor with `configurable: false' for
non-existing property; get: "cannot report a non-configurable
descriptor for non-existent property" But we need it in case
virtual methods
You can (and probably should) advertise a virtual method as
configurable:true.
I can only `configurable: true', but as we said, to fix broken `delete'
operator, we need to treat these virtual properties as non-configurable.
We logically `return false' in `delete' trap and have to adjust
`getOwnPropertyDescriptor' as well.
Well, how to say "have to..."? It just seems the most logical
justification of this broken invariant -- to treat them as
non-configurable. Yes, and by the way, also as non-enumerable since they
will not appear in the for-in.
The proxy throws this exception because, for properties that do not
exist on the wrapped target, it cannot guarantee that they will always
be non-configurable.
What to do with these virtual properties then? It would be good to have
them {configurable: false, enumerable: false, writable: true, value:
noSuchMethodActivator}
For example, if your proxy handler now says that "foo" is {value:10,
configurable:false}, nothing stops your proxy handler from later
claiming that "foo" is {value:0, configurable:true}.
Wait, but we can do the same for any property, including existing. Or am
I missing something?
Cheers,
Dmitry.
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss