xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jim Ley" <...@jibbering.com>
Subject Re: Strange behaviour of Rhino with associative array object
Date Sat, 18 Oct 2003 09:26:05 GMT

"Andreas Neumann" <neumann@karto.baug.ethz.ch> wrote in message
news:1066454983.3f90cfc71e4ee@karmail.ethz.ch...

> Later on I use a "for ... in" loop to extract the values of the
associative
> array.

This isn't really safe, because things in the prototype also can get
enumerated so if I do:

Array.prototype.chicken=function() {alert('a') }

n=[]
n['a']=1

for (i in n) alert(i)

will alert a and chicken

> It appears that the Rhino js engine automatically sorts alphabetically
> according to the index value, which means, that "Asians" come first, then
"
> Blacks", ....

Perfectly valid behaviour, there's no reliability on the ordering, it's
implementation specific, I'd recommend rewriting to avoid needing for i in a
syntax.

Jim.




---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Mime
View raw message