Object.getOwnPropertyDescriptors(O) ? // plural
André Bargull
andre.bargull at udo.edu
Thu Mar 6 15:31:02 PST 2014
On 3/6/2014 11:35 PM, Andrea Giammarchi wrote:
> autocomplete misspelled Andre' , apologies
>
No worries! :-)
>
> On Thu, Mar 6, 2014 at 2:34 PM, Andrea Giammarchi
> <andrea.giammarchi at gmail.com <mailto:andrea.giammarchi at gmail.com>> wrote:
>
> Thanks Andrew, I wonder if I should update the proposed spec
> somehow, but I thought as it is combines both Names and Symbols as
> abstract.
You mean this proposal https://gist.github.com/WebReflection/9353781,
right? It does not need to be changed, because the [[OwnPropertyKeys]]
internal method returns string and symbol valued property keys. Or to be
more correct, it returns string and symbol valued property keys for
ordinary objects. Proxy objects are currently allowed to return any
value from their [[OwnPropertyKeys]] internal method, because the result
value of the "ownKeys" trap is not checked at all. (Except of a simple
type check to ensure it is an object.)
The proposed [[GetOwnPropertyNames]] internal method is supposed to be a
more restrictive version of [[OwnPropertyKeys]] to ensure Proxy objects
don't lie about their properties. This is only required for certain
integrity critical methods, like for example Object.isFrozen().
>
> Please let me know and I'll update.
>
> Best Regards
>
>
> On Thu, Mar 6, 2014 at 1:21 PM, André Bargull <andre.bargull at udo.edu
> <mailto:andre.bargull at udo.edu>> wrote:
>
>> I would rephrase into this:
>>
>> if you need a getOwnPropertyNames trap, you might need for consistency a
>> getOwnPropertySymbols independently from getOwnPropertyDescriptors since
>> these methods are already available.
>
> While it shares the same name with Object.getOwnPropertyNames(),
> this getOwnPropertyNames trap is supposed to return string and
> symbol keyed properties, see
> http://esdiscuss.org/topic/ownpropertykeys .
>
>
>
>> I also would like to add a couple of links to support the fact
>> getOwnPropertyDescriptors
>> is needed, and has been asked for, since quite a while: this was 11th of
>> November 2011 ... I didn't know it, and now that I do I wonder why this has
>> been post-poned for so long and never discussed again.
>>
>> https://mail.mozilla.org/pipermail/es-discuss/2011-November/018275.html
>
> Or even earlier,
> http://wiki.ecmascript.org/doku.php?id=strawman:extended_object_api
> from 2010.
>
>
>> Best Regards
>>
>>
>> On Thu, Mar 6, 2014 at 11:24 AM, C. Scott Ananian <ecmascript at cscott.net <https://mail.mozilla.org/listinfo/es-discuss>>wrote:
>>
>> >/ If you use a getOwnPropertyNames trap, then you also need a
>> /
>> >/getOwnPropertySymbols trap to implement
>> getOwnPropertyDescriptors. />/--scott />//
>> >/ On Thu, Mar 6, 2014 at 2:16 AM, Tom Van Cutsem <tomvc.be at gmail.com <https://mail.mozilla.org/listinfo/es-discuss>> wrote:
>> />/ > 2014-03-05 20:11 GMT+01:00 C. Scott Ananian <ecmascript at cscott.net <https://mail.mozilla.org/listinfo/es-discuss>>:
>> />/ >>
>> />/ >> On Wed, Mar 5, 2014 at 1:39 PM, Tom Van Cutsem <tomvc.be at gmail.com <https://mail.mozilla.org/listinfo/es-discuss>>
>> /
>> >/wrote: />/>> > Object.getOwnPropertyDescriptors(proxy) would
>> trigger the />/>> > getOwnPropertyNames trap, followed by
>> calls to the />/>> > getOwnPropertyDescriptor />/>> > trap for
>> each individual property. />/>> />/>> [[OwnPropertyKeys]],
>> `ownKeys` trap. />/> />/> />/> Yes, according to the current
>> draft spec. I have a pending discussion />/with />/> Allen
>> that we actually need to reintroduce a [[GetOwnPropertyNames]]
>> />/> internal method / getOwnPropertyNames trap, as the
>> `ownKeys` trap />/doesn't do />/> any invariant checking,
>> which is needed for a reliable Object.isFrozen />/test. />/>
>> />/> Regards, />/> Tom />
>
>
>
More information about the es-discuss
mailing list