Property Iteration in JSON serialization

Allen Wirfs-Brock Allen.Wirfs-Brock at microsoft.com
Wed Oct 14 19:01:16 PDT 2009


It's probably too late for us to take advantage of this, but it did just occur to me (too much document.all discussion) that since for-in is a syntactic construct its behavior could be different in strict mode, potentially allowing us to define a for-in enumeration order that isn't tried to legacy behavior.

Similarly, rather than trying to fully specifying for-in enumeration order (and invariably causing potentially breaking changes for some implementations) we could specify a new enumeration statement that uses a strictly specified order.  By suggest for this would be:
   for names (n in expr) ...
and
   for values (v in expr) ...

avoiding conflicts with the existing for-in and E4X for-each.

Allen

>-----Original Message-----
>From: es-discuss-bounces at mozilla.org [mailto:es-discuss-
>bounces at mozilla.org] On Behalf Of Mike Shaver
>Sent: Wednesday, October 14, 2009 6:30 PM
>To: Waldemar Horwat
>Cc: es-discuss
>Subject: Re: Property Iteration in JSON serialization
>
>On Wed, Oct 14, 2009 at 7:24 PM, Waldemar Horwat <waldemar at google.com>
>wrote:
>> No.  As I wrote, there is no de-facto implementation order because the
>> implementations do not agree on the order in general, and what you
>call
>> "fringes" such as numbers do matter.  Trying to force, say, insertion
>order
>> would likely break compatibility.
>
>IIRC, Firefox before FF3 used insertion order for arrays as well as
>objects, and changed to index order for arrays in FF3.  I don't recall
>any compat problems on either side of the transition with respect to
>array iteration order.
>
>Mike
>_______________________________________________
>es-discuss mailing list
>es-discuss at mozilla.org
>https://mail.mozilla.org/listinfo/es-discuss



More information about the es-discuss mailing list