- From: Tab Atkins Jr. <jackalmage@gmail.com>
- Date: Fri, 27 Apr 2012 12:50:21 -0700
- To: Alan Stearns <stearns@adobe.com>
- Cc: www-style list <www-style@w3.org>
On Tue, Apr 17, 2012 at 5:44 PM, Alan Stearns <stearns@adobe.com> wrote: > Do you have any other arguments for maps and against collections? I'm not > convinced that this: > > document.namedFlows['my-flow']; > > Is any easier than this: > > document.getFlowByName("my-flow"); > > The discussion on public-webapps [1] did not show a strong preference one > way or the other, except around collections being better for enumeration. > The use case I'm considering for enumeration is a script that ensures that > every named flow has an associated region chain, to make sure that all the > content is displayed. > > So absent further discussion from you or others I'm inclined to keep these > interfaces as-is. The first example is slightly terser, but you see even greater results if you're using names that are JS ident-friendly: document.namedFlows.mainflow vs document.getFlowByName('mainflow') Enumeration isn't significantly different between the two. For a map, you currently have to remember to check for own properties (a single method call per property), but upcoming JS improvements remove this need. For a collection, you have to remember the name of the method that returns the list of names. Every new name I have to remember is a tax on my language-memory. :/ ~TJ
Received on Friday, 27 April 2012 19:51:10 UTC