[whatwg] native ordered dictionary data type in web storage draft

Ian Hickson ian at hixie.ch
Wed Jun 3 15:42:10 PDT 2009


On Tue, 14 Apr 2009, Patrick Mueller wrote:

> The last paragraph in section 4.6 of the Web Storage draft (10 April 
> 2009), mentions a "native ordered dictionary data type".  The URL to the 
> section in the draft is here:
> 
> http://dev.w3.org/html5/webstorage/#database-query-results
> 
> This is the first time I've seen the requirement for such a beast.  You 
> can understand the desire for it, given the context, but still.  Does 
> anything else in JavaScript make use of such a data structure?
>
> It's not clear to me how you would even use it, without something like a 
> list comprehension, or some other functional construct.  It's hard to 
> imagine how someone might make use of the ordered-ness in a plain old 
> for/in loop, for instance.
> 
> It would also be impossible, in the JavaScript in use today, AFAIK, to 
> emulate this with user-land JavaScript.

On Tue, 14 Apr 2009, Aryeh Gregor wrote:
> 
> It says that JavaScript should just use Object.  Isn't that, 
> essentially, an ordered dictionary?

On Tue, 14 Apr 2009, James Graham wrote:
> 
> Yes. Indeed there are compatibility requirements for the ordering of 
> ordinary user-created Object Objects in web browser implementations; the 
> order of enumeration must be the same as the order of insertion of the 
> properties.

On Tue, 14 Apr 2009, Patrick Mueller wrote:
> 
> Interesting.  I guess this is a "JavaScript in web browser 
> implementation" difference from the "JavaScript spec".  Following the 
> links in jresig's blog post
> 
>    http://ejohn.org/blog/javascript-in-chrome/
> 
> in the "for loop order" section.
> 
> Still doesn't seem like it makes sense to go ahead and build 
> dependencies on this (unfortunate, IMO) behavior.

On Tue, 14 Apr 2009, Aryeh Gregor wrote:
> 
> Isn't HTML5 all about mandating and building dependencies on unfortunate 
> but entrenched behavior?

On Tue, 14 Apr 2009, Patrick Mueller wrote:
> 
> This seems slightly different because it's making a dependency on 
> (unspec'd) JavaScript behavior.  Though I'd guess there are other 
> examples.
> 
> This one may also be significant in that, as we start to see JS usage in 
> other environments, like servers, folks may want to reuse something like 
> the sql access defined in here in those environments.  Who wants two 
> different ways to talk to sql?  It would be nice for this bit to be as 
> clean as it can be.

On Tue, 14 Apr 2009, Maciej Stachowiak wrote:
> 
> FWIW I believe the next version of the ECMAScript spec will specify the 
> order of for..in enumeration.

On Tue, 14 Apr 2009, Patrick Mueller wrote:
> 
> Checking some EcmaScript spec pages, like this one:
> 
> http://wiki.ecmascript.org/doku.php?id=es3.1:es3.1_proposal_working_draft
> 
> it appears that current versions of the spec have basically removed the 
> description that the properties are unordered, without specifying that 
> they're ordered, or how their ordered.  But a step in the 'right' 
> direction, I suppose.

On Tue, 14 Apr 2009, Jonas Sicking wrote:
> 
> As I understand it, the web already depends on this behavior. IIRC 
> EcmaScript 3.1 is going to mandate this behavior, so it'll be specced 
> behavior soon.

Based on the comments above, I have not changed anything in the spec.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'



More information about the whatwg mailing list