[e-lang] Naming convention for variable holding an eventual reference
David-Sarah Hopwood
david.hopwood at industrial-designers.co.uk
Fri May 16 10:01:27 CDT 2008
Sandro Magi wrote:
> I believe JavaScript allows $ in names. The following are all valid
> identifiers from my tests:
>
> var $tmp;
> var tmp$;
> var $tmp$;
> var $t$mp$;
> var tmp_$;
Yes, although you should be looking at the spec *as well as* testing :-)
<http://www.ecma-international.org/publications/standards/Ecma-262.htm>
> $ seems like a fairly recognizable symbol, particularly as a suffix.
Section 7.6 of ECMA-262 3rd ed. says:
# [...] The dollar sign ($) and the underscore (_) are permitted
# anywhere in an identifier. The dollar sign is intended for use only
# in mechanically generated code.
OTOH, that intention is widely flouted, e.g. by libraries such as
Prototype.
--
David-Sarah Hopwood
More information about the e-lang
mailing list