Skip to content
This repository was archived by the owner on Feb 12, 2022. It is now read-only.

Conversation

@cmcculloh-kr
Copy link

I'm OK with saying that people can omit braces in a unique particular instance if they want, but, I am extremely uncomfortable dictating that they must not use braces in some subjective instances. I find it an acceptable evil to ommit braces in some cases if you really want, but, would rather the consistency of just saying "always use braces".

@interactivellama
Copy link
Contributor

Sounds good to me.

@swilliamset
Copy link

+1 I believe many of these suggestions/guidelines/standards need to be more in the spirit of consistency.

Next question does each bracket get its own line? If not is there a space before/after the bracket? So many options ;)

@cmcculloh-kr
Copy link
Author

+1 on the "spirit of consistency" thing. As a college professor of mine always said, "It doesn't so much matter what you choose, but that you choose something and stay consistent"

You might be trolling about C style bracketing, but, just in case you aren't, I prefer exactly what is (now) lain out in the spec. ie. That the initial bracket is on the line that needs it and the closing bracket is on it's own line:

if() {
    //doo dad
}

The reason for this is that:

if ()
{
    //doo dad
}
else
{
    //doo did
}

Both wastes space and is actively dangerous. It would be all too easy for someone not paying attention to accidentally make it:

if ()
{
    //doo dad
}

//moar code (didn't notice the `else`)

else
{
    //doo did
}

cmcculloh-kr pushed a commit that referenced this pull request Oct 24, 2014
Always use braces (three's a crowd! merging)
@cmcculloh-kr cmcculloh-kr merged commit 286d91f into master Oct 24, 2014
@kevinparkerson
Copy link

So long as I can do this:

if(1===1){
    //do thangs
}

I'm happy. I like my characters riding all up on each other, the extra spaces are unnecessary and ugly IMO

@cmcculloh-kr
Copy link
Author

You can write it that way, but, if you use the esformatter definition that (either is, or will shortly be) is in this project, it will auto-convert it to this:

    if (1 === 1) {

    }

@cmcculloh-kr
Copy link
Author

If you don't use the esformatter, no worries, but, when someone else does and they save the file, it will convert it at that point.

@cmcculloh-kr cmcculloh-kr deleted the always-use-braces branch October 24, 2014 16:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants