Hi,

Alexander Klimetschek schrieb:
> On Sat, Jun 6, 2009 at 5:55 PM, Felix Meschberger<fmesc...@gmail.com> wrote:
>>> On Fri, Jun 05, 2009 at 09:18:05PM +0200, Alexander Klimetschek wrote:
>>>> I think they are not equivalent in the strict Javascript sense, as the
>>>> order of the properties in an object is defined (you can iterate over
>>>> it). It is not to be seen as a pure hash map.
>> This is wrong. The spec explicitly states that there is no defined order
>> amongst the properties of an object.
>>
>> Now, in reality, the known browsers implement objects in a way, that the
>> properties have a factual insertion order. But, this is an
>> implementation specific thing.
> 
> Ok, I didn't know it was specified as free. But since the popular
> implementations (browsers) all follow the same way, ie. keep the order
> (in Javascript), one should follow this to keep free from unwanted
> problems.

I do not agree. One should follow the spec and consider the browser
implementations what they are: implementations of the spec where it
happens to be that the properties seem to have an order.

But yes, the Sling JSONObject also supports the property ordering due to
popular request of users depending on this implementation specific...

Regards
Felix

Reply via email to