Property Iteration in JSON serialization
bkardell at gmail.com
Wed Oct 14 19:48:03 PDT 2009
Sure, but again... Without any changes it currently reads:
"The mechanics and order of enumerating the properties (step 6.a in
the first algorithm, step 7.a in the second) is not specified. "
Which isn't really necessary even currently (pre-5 I think) doesn't
accurately describe what seems to be the de-facto standard. It should
be relatively easy to merely codify what is already implemented
everywhere which sounds like without any disagreement or "new"
proposals it could say something along the lines of:
"For objects containing no indexed properties the mechanics and
default order of enumerating the properties (step 6.a in the first
algorithm, step 7.a in the second) is specified as insertion order.
For reasons of historical compatibility, the default order of
enumerating the properties of objects which contain indexed properties
is not specified. "
That's not to say that no further effort should be made to take it
even further, but I for one would find something like the above a lot
more comforting and realistic than nothing at all if it comes to that.
On Wed, Oct 14, 2009 at 7:01 PM, Allen Wirfs-Brock
<Allen.Wirfs-Brock at microsoft.com> wrote:
> 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) ...
> for values (v in expr) ...
> avoiding conflicts with the existing for-in and E4X for-each.
>>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
>>Subject: Re: Property Iteration in JSON serialization
>>On Wed, Oct 14, 2009 at 7:24 PM, Waldemar Horwat <waldemar at google.com>
>>> 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
>>> "fringes" such as numbers do matter. Trying to force, say, insertion
>>> 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.
>>es-discuss mailing list
>>es-discuss at mozilla.org
> es-discuss mailing list
> es-discuss at mozilla.org
More information about the es-discuss