Do we really need the [[HasOwnProperty]] internal method and hasOwn trap

Brandon Benvie brandon at brandonbenvie.com
Tue Nov 13 00:43:25 PST 2012


Woops I forgot ___ which is 0. Non-enumerable, non-configurable,
non-writable. Since undefined is what indicates lack of a property, this
isn't an issue. As for bounding, it's simple enough to specify the valid
range to be 0-12. Or use strings with the names instead of numbers, though
that loses the ability to combine flags via bitwise ops.

I also forgot to mention how accessors could work. In my experience using
this model in place of descriptors, accessors live where the value would
be. If a query indicates that a property is an accessor then the value
returned from 'get' needs to conform to something like { get, set }.
Another option would be to use another trap or another param to indicate
'get' is to return the getter/setter for a property instead of the
calculated value. Data properties are far more common and it's worth
optimizing for their use in terms of both API complexity and performance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20121113/dfbe34bc/attachment.html>


More information about the es-discuss mailing list