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

Arrays in WebIDL aren't making sense to me so far

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Mon, 02 Apr 2012 11:06:27 -0400
Message-ID: <4F79C073.9050405@mit.edu>
To: "public-script-coord@w3.org" <public-script-coord@w3.org>
I was reading the array sections of WebIDL, and I had two questions.

1)  The spec says that for platform array objects the [[Extensible]] 
property is always true.  Why is that, exactly?  Shouldn't one be able 
to Object.seal() or Object.preventExtensions() platform array objects? 
It's doable for other platform objects, afaict...

2)  http://dev.w3.org/2006/webapi/WebIDL/#idl-array says that arrays are 
passed by reference and that "Passing an array to a platform object 
could result in that array being modified by the object."  However 
http://dev.w3.org/2006/webapi/WebIDL/#es-array says that converting an 
ES value to an IDL array always allocates a new array.  I'm not sure how 
to reconcile these two statements; at the moment I'm assuming that the 
informative text at the first link is in error and the normative 
requirements are correct: arrays are passed by value but returned by 
reference.  Is that right?

-Boris
Received on Monday, 2 April 2012 15:07:03 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 May 2013 19:30:06 UTC