ES Style Question

Rick Waldron waldron.rick at gmail.com
Fri Sep 9 14:33:47 PDT 2011


Wes,

I was referring to the _very_ first reply to this thread.

Thanks again

Rick



-- Sent from my Palm Pre
On Sep 9, 2011 4:48 PM, Wes Garland <wes at page.ca> wrote: 

On 9 September 2011 16:06, Rick Waldron <waldron.rick at gmail.com> wrote:

I was actually very specifically looking for an answer regarding First letter casing for non-constructor built-in objects, ie. Math and Proxy. I think the legacy Java style guide influence addresses the question as best as I can hope for.


These  *did* come to us via Java (well, not Proxy), but they are hardly a matter of style; they are a matter of specification.

Generally we name constructor functions with CapitalLeadingCamelCase and everything else with smallLeadingCamelCase.  I think I picked this up from JavaScript: The Definitive Guide, 2nd Edition, by David Flanagan, about 4,000 years ago.


As for other matters of style, I am a big proponent of brace-on-a-line in C-syntax languages, however this has proven to be a problem in practice with JavaScript due to the interaction between automatic semicolin insertion and object literal syntax in return statements:


return{ 
  Hello: "world" };

is not the same as

return {  Hello: "world"
}

Wes

-- 
Wesley W. Garland
Director, Product Development
PageMail, Inc.
+1 613 542 2787 x 102


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110909/ada08092/attachment-0001.html>


More information about the es-discuss mailing list