[Bug 22391] Sequence or Array

https://www.w3.org/Bugs/Public/show_bug.cgi?id=22391

--- Comment #9 from Boris Zbarsky <bzbarsky@mit.edu> ---
Domenic, I'm not sure what you mean by "non-frozen, snapshot".

Fundamentally, there are several kinds of APIs:

1)  API that just returns a new array each time.  These should return a
sequence
    (which means just a normal writable JS Array) and should be methods, not
    property getters.
2)  API that keeps returning the same array object as long as its contents do
not
    change.  This can be a method, of course (returning a frozen JS Array, say,
    so that one caller can't mess up what other callers see).  Can it be a
    property getter?  It seems like this is an OK thing to do, actually, since
    the new object would only appear when the list being represented has in
fact
    changed.
3)  APIs that return some sort of live arraylike collection.  The problem here
is
    that in most cases the liveness means that the DOM implementation needs to
be
    able to write into the array but callers need to not be able to do so. 
What
    that means is that the script-visible behavior is basically some sort of
    proxy around an Array.

As I said in comment 4, there has been a general movement away from case 3 in
API design.  Case 1 is non-controversial.  So the main interesting thing is
case 2.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Wednesday, 10 July 2013 20:29:12 UTC