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

RE: Guidance on using sequences and arrays

From: Domenic Denicola <domenic@domenicdenicola.com>
Date: Wed, 26 Jun 2013 15:23:15 +0000
To: Boris Zbarsky <bzbarsky@MIT.EDU>, Marcos Caceres <w3c@marcosc.com>
CC: "public-script-coord@w3.org" <public-script-coord@w3.org>
Message-ID: <B4AE8F4E86E26C47AC407D49872F6F9F8781B515@BY2PRD0510MB354.namprd05.prod.outlook.com>
From: Boris Zbarsky [mailto:bzbarsky@MIT.EDU]

> On 6/26/13 11:00 AM, Marcos Caceres wrote:
> >> As in get notified when it changes? Or as in always see whatever the
> >> state is now as opposed to what it was then?
> >
> > Yes, get notified when it changes.
> 
> OK, that tells you nothing about array vs sequence.  As in, when the notification happens you could re-examine the object you already have, or you could getCalls() to get a new sequence, depending on whether the object you have mutates itself.

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!)

(On second thought, I suppose a two-layered system like promises have, where the creator retains modification rights but the user cannot mess with it, would work. But that would definitely not be array-like in behavior, and would need to be implemented using proxies, so, kinda weird.)
Received on Wednesday, 26 June 2013 15:23:51 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:13 UTC