- From: Ian Hickson <ian@hixie.ch>
- Date: Fri, 11 Mar 2011 01:47:46 +0000 (UTC)
- To: Cameron McCormack <cam@mcc.id.au>
- cc: Anne van Kesteren <annevk@opera.com>, Simon Pieters <simonp@opera.com>, Arun Ranganathan <arun@mozilla.com>, public-webapps <public-webapps@w3.org>
- Message-ID: <Pine.LNX.4.64.1103110142430.944@ps20323.dreamhostps.com>
On Fri, 11 Mar 2011, Cameron McCormack wrote:
> Ian Hickson:
> > Web Apps 1.0 will change if you need it to. Don't constrain on my account
> > here. I'll do whatever you think we should do. The only places I use it
> > are in an argument to a method because I want to allow authors to pass in
> > literal JS Arrays of values, and on a NodeList descendant where I just
> > wanted the user of the API to be able to get a JS Array of values. I don't
> > think there's much implementation compatibility constraint here.
>
> OK.
>
> The latter isn’t a good use, BTW, as mentioned in the reply to Anne,
> because it would mean a fresh Array object is constructed each time you
> get the values property of PropertyNodeList. So for what you might
> expect to be a common usage pattern,
>
> for (var i = 0; i < myPropertiesCollection.values.length; i++) {
> doSomethingWith(myPropertiesCollection.values[i]);
> }
>
> it’s going to result in a lot of wasted work. To make it clear that’s
> going to happen, I’d recommend making it a method instead.
Makes sense. What I really want is a NodeList-like interface, but ideally
one that supports all the Array accessors, but I don't want to have to
redefine it each time. Is there some way we could get a "macro" for that
kind of thing?
See also:
http://www.w3.org/Bugs/Public/show_bug.cgi?id=11195
> I think sequence<T> is fine for the purpose of accepting a JS Array of
> items as a method argument. Presumably the requirement to have
> something like that in WA 1.0 isn’t going away, and there isn’t
> another way to do that in Web IDL currently, so unless there are
> concrete problems with sequence<T> or anyone has ideas on how to do it
> better, I’ll just leave it alone for now.
Is there some way we can make it only be allowed in arguments to
host-implemented APIs?
--
Ian Hickson U+1047E )\._.,--....,'``. fL
http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,.
Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
Received on Friday, 11 March 2011 01:48:16 UTC