Arrays with non-integer properties

Serge LE HUITOUZE slehuitouze at telisma.com
Mon Oct 15 08:16:45 PDT 2007


David "liorean" Andersson wrote:


> > At some point of SISR chapter 7, more precisely item 5 in section 7.1, I find
> > the following wording concerning EMMA (i.e. XML) serialization of ECMA arrays:
> > "Any other properties of an Array object, for instance the keys of an associative
> > array (e.g. a["prop"]), are subject to the same transformation rules as the
> > regular properties of an object. In a sparse array, only those elements which
> > hold defined values will be serialized."
>
> That text is a bit wrong. It's the element and not the value that is
> defined or not. A defined element can have undefined as it's value.
> Serialisation should differentiate the two, because the elements that
> are not defined can be elided in the serialisation while the elements
> that are defined cannot be elided.

It's yet another example of the sloppiness of SISR standard when it comes
to its connections with ECMA...

Upon reading, it is indeed unclear whether the spec is simply nonsensical,
or whether it's dealing with properties/elements having the special value
"undefined"...


> > [...] It is thus obviously (at least, that's how I analyse it) not
> > the way one should serialize such an array.
>
> It cannot be serialised using JSON/ES3 literal syntax. Not if you want
> to retain both the array-ness and the properties with non-array-ish
> names.

I find this pretty embarrassing: the standard discusses how to serialize
in XML format the "non-array-ish" properties of an array, but it so happens
that it's impossible to render them in ECMA format!

--Serge

No virus found in this outgoing message.
Checked by AVG Free Edition. 
Version: 7.5.488 / Virus Database: 269.14.10/1070 - Release Date: 14/10/2007 09:22
 



More information about the Es4-discuss mailing list