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

Guidance on using sequences and arrays

From: Marcos Caceres <w3c@marcosc.com>
Date: Wed, 26 Jun 2013 11:15:32 +0100
To: public-script-coord <public-script-coord@w3.org>
Cc: Cameron McCormack <cam@mcc.id.au>
Message-ID: <C2EB476A34194657B20D817D5D6BC907@marcosc.com>
I'm wondering if someone can provide me with some guidance wrt using sequences vs arrays? I'm currently working on a spec that allows a user agent to manage phone calls, which defines the following:

interface TelephonyManager {
readonly attribute Call[] calls;

The items inside the array "calls" attribute are supposed to reflect the phone calls currently being managed by the user agent. The user agent pops/pushes items in and out that array over the lifecycle of the application.     

What I'm confused about is what does "readonly" mean in the above. Clearly, it means that the reference of the array in the attribute can't be changed - but what about the content of the array? Can a developer do the following:


If so, that would obviously be bad. Would it then be appropriate to change the calls attribute to a sequence (i.e., sequence<Call> getCalls())?  

Marcos Caceres
Received on Wednesday, 26 June 2013 10:16:07 UTC

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