Lecture series on SES and capability-based security by Mark Miller

Axel Rauschmayer axel at rauschma.de
Fri Nov 4 18:42:59 PDT 2011

>> So Object.prototype customization would cover all cases? Except Proxies, of course -- and host objects.
> Yes, except that what you would expect to put into Object.prototype would actually (or also) be defined as default behavior in order to ensure that that Object.create(null) objects, etc continue to have ES1-5 behavior.  Because collection behavior is defined via  method invocation, proxies don't  need to do/have anything special (although a Proxy's [[Get]] handler) could look for accesses to the special [ ] behavior methods.  Same for host objects, except who knows what a host object really is...

Have you come to a decision with regard to a separate .[] operator for collections (including arrays)?

I think it’s better to rededicate []:
- .[] would invalidate all existing array code.
- [] would only invalidate code that uses computed property names. And that can be fixed via the default behavior.

It might make sense to have a "stricter mode" that turns off the default behavior of []:
- It would thus force you to use methods such as (the yet to be defined) Object.setOwnProperty() and Object.getProperty() when you want to compute the name of a property.
- Stricter mode could also restrict [] for arrays to just numbers, including negative numbers for accessing elements relative to the end of an array.

Dr. Axel Rauschmayer
axel at rauschma.de

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20111105/d24b8f93/attachment.html>

More information about the es-discuss mailing list