Tutorials, extensions, and source files for ActionScript, Flash, and other Adobe products.


Dollar Sign ($) in ActionScript Identifiers? It's a No-no

Posted September 11, 2008 by senocular

Do you use $ in your ActionScript for class or member names? (I know I've seen it used sometimes in place of the underscore (_) for private members.) If you do, maybe you shouldn't.

I recently caught wind of this little paragraph in the ECMAScript language spec (section 7.6):

"This standard specifies one departure from the grammar given in the Unicode standard: The dollar sign ($) and the underscore (_) are permitted anywhere in an identifier. The dollar sign is intended for use only in mechanically generated code."

This came up as a result of some issues I was having sorting out class member definitions that did in fact use the dollar sign in their identifier names. Tisk tisk.