W3C home > Mailing lists > Public > public-script-coord@w3.org > April to June 2013

Re: Guidance on using sequences and arrays

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Wed, 26 Jun 2013 11:31:29 -0400
Message-ID: <51CB0951.8060209@mit.edu>
To: Domenic Denicola <domenic@domenicdenicola.com>
CC: Marcos Caceres <w3c@marcosc.com>, "public-script-coord@w3.org" <public-script-coord@w3.org>
On 6/26/13 11:23 AM, Domenic Denicola wrote:
> This is actually a really important point. `getCalls()` returning a fresh, but mutable, array seems much more reasonable than a `calls` property that (a) cannot be messed with by script; (b) changes out from under you due to C++ magic. Unfortunately that does kill any hopes of using `Object.observe` since there's no single object you can observe.
>
> I think if you contemplated how to implement this in JavaScript there's not much else that would make sense. (Could be wrong, though!)

Well, both are implementable in JS.  .calls can return a proxy for an 
array that allows reads but not writes, etc...

Not many libraries today would implement it that way, not least because 
proxy support in UAs is spotty.  But if it were not spotty, I'm not sure 
what people would do.

My gut feel is that a getCalls() that returns a new object, but this is 
me trying to think like a JS programmer, which is a nontrivial exercise.

-Boris
Received on Wednesday, 26 June 2013 15:31:57 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:37:49 UTC