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

2009-06-03 Thread Ian Hickson
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.   `._.-(,_..'--(,_..'`-.;.'


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

2009-04-14 Thread Patrick Mueller
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.


--
Patrick Mueller



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

2009-04-14 Thread Aryeh Gregor
On Tue, Apr 14, 2009 at 10:18 AM, Patrick Mueller
pmue...@muellerware.org wrote:
 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 says that JavaScript should just use Object.  Isn't that,
essentially, an ordered dictionary?

(My knowledge of PHP is better than my JavaScript -- in PHP, the
*only* native array type is an ordered dictionary.)


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

2009-04-14 Thread James Graham

Aryeh Gregor wrote:

On Tue, Apr 14, 2009 at 10:18 AM, Patrick Mueller
pmue...@muellerware.org wrote:

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 says that JavaScript should just use Object.  Isn't that,
essentially, an ordered dictionary?


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.


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

2009-04-14 Thread Aryeh Gregor
On Tue, Apr 14, 2009 at 1:54 PM, Patrick Mueller
pmue...@muellerware.org wrote:
 Still doesn't seem like it makes sense to go ahead and build dependencies on
 this (unfortunate, IMO) behavior.

Isn't HTML5 all about mandating and building dependencies on
unfortunate but entrenched behavior?


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

2009-04-14 Thread Patrick Mueller

Aryeh Gregor wrote:

On Tue, Apr 14, 2009 at 1:54 PM, Patrick Mueller
pmue...@muellerware.org wrote:

Still doesn't seem like it makes sense to go ahead and build dependencies on
this (unfortunate, IMO) behavior.


Isn't HTML5 all about mandating and building dependencies on
unfortunate but entrenched behavior?


web storage is not yet entrenched.  Unless you count Safari :-)

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.


--
Patrick Mueller



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

2009-04-14 Thread Jonas Sicking
On Tue, Apr 14, 2009 at 10:54 AM, Patrick Mueller
pmue...@muellerware.org wrote:
 James Graham wrote:

 Aryeh Gregor wrote:

 On Tue, Apr 14, 2009 at 10:18 AM, Patrick Mueller
 pmue...@muellerware.org wrote:

 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 says that JavaScript should just use Object.  Isn't that,
 essentially, an ordered dictionary?

 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.

 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.

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.

/ Jonas


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

2009-04-14 Thread Maciej Stachowiak


On Apr 14, 2009, at 1:03 PM, Patrick Mueller wrote:


Aryeh Gregor wrote:

On Tue, Apr 14, 2009 at 1:54 PM, Patrick Mueller
pmue...@muellerware.org wrote:
Still doesn't seem like it makes sense to go ahead and build  
dependencies on

this (unfortunate, IMO) behavior.

Isn't HTML5 all about mandating and building dependencies on
unfortunate but entrenched behavior?


web storage is not yet entrenched.  Unless you count Safari :-)

This seems slightly different because it's making a dependency on  
(unspec'd) JavaScript behavior.  Though I'd guess there are other  
examples.


FWIW I believe the next version of the ECMAScript spec will specify  
the order of for..in enumeration.


Regards,
Maciej



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

2009-04-14 Thread Patrick Mueller

Maciej Stachowiak wrote:


On Apr 14, 2009, at 1:03 PM, 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.


FWIW I believe the next version of the ECMAScript spec will specify the 
order of for..in enumeration.


And that's another way to resolve the issue!  :-)

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.


--
Patrick Mueller