[Dojo-interest] Code conventions

Dylan Schiemann mail at dylans.org
Tue Apr 4 17:11:19 MDT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Torkel Holm wrote:
> Alex Russell wrote:
>> On Wednesday 22 March 2006 3:26 am, Torkel Holm wrote:
>>
>>> Is the style guide[1] deprecated?
>>> I do a lot of diving through the source and it doesn't seems
>>> that everyone agrees about it ;)
>>
>> Feel free to point to places that don't conform. We'd like to fix them.
> 
> It's primarly about the layout section.
> 
> I can probably pick a random file and find all permutations of different
> statement layouts etc. where different coders have contributed ;)
> 
> I don't think a need to give a rationale for this.
> 
> Lets take the for-statement
> 
> (1)
> // compact
> for(initialization;condition;increment){
> 
> (2)
> // space before the opening brace
> for(initialization;condition;increment) {
> 
> (2)
> // space after semicolon
> for(initialization; condition; increment){
> 
> (3)
> // space after reserved word and before brace
> for (initialization; condition; increment) {
> 
> Why not strictly follow the "de facto" Java (I know we are talking about
>  Javascript ;) ) code conventions promoted by Sun which are used by both
> Mozilla and Microsoft for Javascript code?
> 
> example:
> 
> for(var i=0;i<a.length;i++){
>     doSomething();
> }
> // vs
> for (var i = 0; i < a.length; i++) {
>     doSomething();
> }
> 
> I prefer to used the rhino compressor and gzip :)

Alex, are you sure you aren't posting under a different name ;)

Seriously though, I think most of us prefer:

for (var i=0; i<a.length; i++) {

Really though, minor whitespace differences like this just isn't that
important to me.  I leave that to the python community :p

- -Dylan
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEMv0X8nLgh/JJsxERAkRkAJwL05Uhr9GS9hDfrTQH0cJS1U9F6QCdEnGI
kriZpKLOvGn/OnQe+MFH0B0=
=3YkU
-----END PGP SIGNATURE-----


More information about the Dojo-interest mailing list