[[Extensible]]and Proxies (Was: Proxy.isProxy )

Brendan Eich brendan at mozilla.com
Thu Jul 14 10:47:45 PDT 2011


On Jul 14, 2011, at 10:38 AM, David Bruant wrote:

>> In all the cases I can think of, where we want precisely the behavior of an array, why not just use an array?
> Of course an array should be used. I think that the current question is rather "can proxies as currently defined can fully emulate arrays?". Being able to fully emulate arrays sounds like an "easy" use case.

I agree, and Allen is on the record here too.

Fixing an array-proxy to an array could be enough for real-world use-cases, so this may be not a burning practical issue. Indeed it verges on Principle. But it's a good one, and I think we should have a goal (rather than a principle) for cleanly proxying arrays, including non-extensible ones.

If this goal is met by saying fixing an array proxy always results in the instance becoming a fixed Array, that could be good enough.

I do not think we should say "fix to a non-extensbile object with a length accessor" while we at the same time carefully spec Array length as a data property, precisely to ensure inter-operation. That seems to be telling JS implementors one thing, and (possibly an overlapping group) proxy users another.

/be


More information about the es-discuss mailing list