long is a reserved keyword in Safari

May 25 2007

This is more a note to myself than anything else, but it might help someone pulling their hair out over this particular bug.

Apparently, long is a reserved keyword in the Safari browser (I’m using 2.0.4, but it’s fixed in the WebKit nightlies), so be careful if you’re using it as a variable name—I’ve been working with the Multimap API today, so lat and long seemed like perfectly natural properties of my hotel objects until Safari choked.

According to this list of reserved keywords in JavaScript , long is a Java keyword. I guess Firefox is more forgiving than Safari.

Filed under: Javascript.

Technorati tags:

Digg this article

Bookmark this article with del.icio.us

Previously: Grid Calculator 1.1

Next: Simple Photoshop tricks: Creating interesting drop shadows


Comments

Adam Roben
405 days ago

“long” is a “future reserved word” of ECMAScript-262 (see page 14 of http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf), which is why Safari treats it as such.

#1