Re: Naming convention for variable holding an eventual reference

David-Sarah Hopwood <david.hopwood-mRVxzIiVagSlV3Ge8JjJtnfLna9zW77MtUK59QYPAWc@public.gmane.org>
Newsgroups gmane.comp.lang.e.general
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.