LWN.net Logo

World-writable memory on Samsung Android phones

World-writable memory on Samsung Android phones

Posted Dec 21, 2012 2:57 UTC (Fri) by idupree (subscriber, #71169)
In reply to: World-writable memory on Samsung Android phones by sorpigal
Parent article: World-writable memory on Samsung Android phones

Keys in JavaScript objects are strings. Javascript arrays (and strings) are Javascript objects. Therefore, keys of Javascript arrays are strings (they are string representations of numbers, to be precise, or of non-numbers if you explicitly add non-number keys to an array object).

Yes, it really is that absurd. And no, it doesn't necessarily impact performance, because modern Javascript engines are often smart enough to undo this oddity without changing the language semantics.


(Log in to post comments)

World-writable memory on Samsung Android phones

Posted Dec 21, 2012 15:00 UTC (Fri) by sorpigal (subscriber, #36106) [Link]

it doesn't necessarily impact performance, because modern Javascript engines are often smart enough to undo this oddity without changing the language semantics

"Often" is not always; crazy isn't that far behind us.

I wonder, now, about the performance of code I've written where complex objects and functions have been used as keys. I imagined I was storing pointers, but if the key is really the stringification of the object... that can't be good.

I suppose it sort-of makes sense that somebody decided storing a numeric key as a string was less scary than storing it as a float, but the madness has to stop some time.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds