W3C home > Mailing lists > Public > public-webapps@w3.org > October to December 2011

Re: QSA, the problem with ":scope", and naming

From: Bjoern Hoehrmann <derhoermi@gmx.net>
Date: Thu, 20 Oct 2011 22:42:54 +0200
To: Alex Russell <slightlyoff@google.com>
Cc: Webapps WG <public-webapps@w3.org>
Message-ID: <j001a7t0r481k9rcqi9cql5804282hr9f4@hive.bjoern.hoehrmann.de>
* Alex Russell wrote:
>I strongly agree that it should be an Array *type*, but I think just
>returning a plain Array is the wrong resolution to our NodeList
>problem. WebIDL should specify that DOM List types *are* Array types.
>It's insane that we even have a NodeList type which isn't a real array
>at all.

It is quite normal to consider lists and arrays to be different things.
In Perl for instance you can use list operations like `grep` on arrays,
but you cannot use array operations like `push` on lists. For JavaScript
programmers it actually seems common to confuse the two, like with

  var node_list = document.getElementsByTagName('example');
  for (var ix = 0; ix < node_list.length; ++ix)
    node_list[ix].parentNode.removeChild(node_list[ix]);

which would remove all the children if node_list was an array like any
other. Pretending node lists are arrays in nomenclature would likely add
to that.
-- 
Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
Am Badedeich 7 · Telefon: +49(0)160/4415681 · http://www.bjoernsworld.de
25899 Dagebüll · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 
Received on Thursday, 20 October 2011 20:43:22 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:48 GMT