Strictness of language styling

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Nov 10 15:01:24 PST 2014


On Mon, 10 Nov 2014 14:00:32 -0800
"H. S. Teoh via Digitalmars-d-learn"
<digitalmars-d-learn at puremagic.com> wrote:

> I used to be an Egyptian-braces / tabs-only-indentation advocate. That
> works reasonably well in C/C++, but I find that with idiomatic D, Phobos
> style actually works much better. (Well, except that horrid camelCasing,
> but hey, you can't win every battle.)  D code tends to require many more
> levels of indentation than C/C++, so using tabs can be quite cumbersome.
> also, Egyptian braces tend to work better when the leading line of
> nested blocks is simple, but in D, esp. with the complexity of function
> declarations, the opposite is true.
i HATE tabs. i hate tabs so much that all of my scripting languages
considers tab character as fatal syntax error.

> But at least none of us use the following bracing style, which I had the
> misfortune of coming across many years ago (I kid you not, people
> actually exist who write code like this):
> 
> 	int my_func(int arg) {
> 		if (arg==1) {
> 			printf("One\n");
> 			}
> 		else {
> 			printf("Not one\n");
> 			}
> 		for (i=0; i<10; i++) {
> 			int x = i*2;
> 			do_something_else(x);
> 			}
> 		}
> 
> I think I needed therapy after encountering this. :-P
please, make me unsee that!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20141111/328a5b36/attachment.sig>


More information about the Digitalmars-d-learn mailing list