User:Avarma/Coding Style
Introduction
My coding style is generally a compromise between the Mozilla JavaScript Style Guide, the vagaries of what js2-mode happens to be compatible with, and my own personal tastes.
Because I started the Jetpack and Ubiquity projects, much of their code happens to conform to this style.
Comments
Comments are always C++-style, starting with a //. This is partly because:
- It's hard to remember how to format C-style (/* */) lines consistently,
- Emacs constantly gets confused with C-style comments because there's so many different styles of using them,
- Virtually all other programming languages use a minor variation on C-style comments, e.g. using # as the comment prefix instead of //, making it easy to convert common comment code (e.g. license blocks) from one language to another,
- C++-style comments can easily be nested, while C-style comments cannot.
Furthermore, the comments before functions or sections of code are usually commented using WikiCreole syntax, so as to be compatible with Code Illuminated.