noSuchMethod: "funargs" + "invoke-only-phantoms"
dmitry.soshnikov at gmail.com
Sun Dec 18 10:10:42 PST 2011
On 18.12.2011 2:51, Brendan Eich wrote:
> From: "Dmitry Soshnikov"<dmitry.soshnikov at gmail.com>
>> On 17.12.2011 17:21, Herby Vojčík wrote:
>>> from my point the scenario that:
>>> delete lib.toRussianName;
>>> then it still:
>>> typeof lib.toRussianName; // "function", Trollface ;D
>>> is much more acceptable (it happens everyday - there are non-writable
>>> properties everywhere),
>> Yes, good point on non-configurable properties. So, we may justify this
>> broken invariant with `delete' which becomes not so broken. it's good.
> Not so fast: the result of the delete expression differs in the non-configurable case (false) from the no-such-property case (true).
Right, we have to adjust `delete' trap as well. And, if we treat these
virtual methods as non-configurable, the to adjust also
`getOwnPropertyDescriptor' hook too.
I edited the implementation: https://gist.github.com/1481018#L229
Still, some problems appear after that:
- if we return descriptor at `getOwnPropertyDescriptor', potentially
this means that the user can change some attributes via
`Object.defineProperty'. E.g. to set `enumerable' to false, and we have
to handle it in `defineProperty' hook. OTOH, if our property is
non-configurable, it means user can't change some attribute values in
- @Tom: Found bugs in DirectProxies.js
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
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
More information about the es-discuss