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?

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

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