[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 113: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
The Nightstar Zoo • View topic - Proposal for a brace style notation

The Nightstar Zoo

Nightstar IRC Network - irc.nightstar.net
It is currently Mon Jul 15, 2019 9:54 pm

All times are UTC - 6 hours [ DST ]

Post new topic Reply to topic  [ 2 posts ] 

What do you think of this idea?
Excellent suggestion, now convince people to use it 0%  0%  [ 0 ]
It's a good idea, but this particular notation is too ugly 25%  25%  [ 1 ]
There's no need for it 25%  25%  [ 1 ]
I don't use those languages anyway 0%  0%  [ 0 ]
Schlock eats Archbishop Thomas Cranmer (deceased) after distracting Adolf Menjou with a demonic duck of some sort 50%  50%  [ 2 ]
Total votes : 4
Author Message
PostPosted: Sat Nov 12, 2005 1:40 pm 
It has occurred to me that it would help if programmers for languages using braces had a notation for describing the different brace styles succinctly. My specific proposal is for a series of letter-number codes for each each of the possible brace locations and indent levels. The first code would be the location of the leading brace and it's indentation (with the letter code in upper case), the second the code indentation, the third the position and indentation of the trailing brace (with the letter in lowercase), the fourth the handling of braces around else statements (and the spacing around the code body in the case of cuddled elses), and the fifth for the handling of single expressions (and the spacing around the code body for in-line blocks).

The letter abbreviations would be T (terminal, for the lead brace at the end of the expression), S (successive, for the lead brace on the line following the expression), C (cuddled, for 'cuddled' elses, e.g., ones with the closing brace of the if and the opening brace of the else on the same line as the else itself), U (uncuddled) and the spacing around the code body, L (linear, for a single-statement body that has both braces inline with the statement), N (non-linear, for applying the normal brace rules to single statement blocks), and B (bare, for single expressions with no braces).

For example, 1TBS as it's usually described would be T1:8:s0:C0:B. Similarly, GNU style would be S3:8:s3:U:N, and Allman style would be S0:8:s0:U:B. Since the most common cases do not use cuddled braces, have the trailing brace on the line following the code body with no indentation, and (unfortunately) omit braces around single expressions, the latter could be abbreviated to S0:8.

While this is cryptically terse, it does cover most of the common variations on brace style as I know them. Any comments or alternatives?

 Post subject:
PostPosted: Wed Nov 16, 2005 7:11 am 
Safari Exhibit
Safari Exhibit
User avatar

Joined: Mon Feb 07, 2005 3:48 am
Posts: 151
Location: Durban, South Africa

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours [ DST ]

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group