November 10, 2014
On Mon, Nov 10, 2014 at 09:36:18PM +0000, via Digitalmars-d-learn wrote:
> On Monday, 10 November 2014 at 19:37:06 UTC, H. S. Teoh via Digitalmars-d-learn wrote:
> >I have to say that I *hate* camelCase... it looks really ugly. But what looks uglier is a mixture of camelCase and something else.
> 
> Ah, but here I disagree. I like to use different formatting for different levels of semantics. I prefer lower case for ADT structs and CamelCasedClassesToSignifyDomainSpecificity.
> 
> Basically distinguishing high level from low level. It makes sense to give more EMPHASIS to high level constructs.
> 
> (but camelCase in ADTs and generic libraries suck ;-)

No idea what you're talking about, but I was referring to squishingAllWordsIntoOneUnreadableMess vs. keeping_them_visually_separate_and_readable.


T

-- 
Computerese Irregular Verb Conjugation: I have preferences.  You have biases.  He/She has prejudices. -- Gene Wirchenko
November 10, 2014
On Monday, 10 November 2014 at 22:04:20 UTC, H. S. Teoh via Digitalmars-d-learn wrote:
> No idea what you're talking about, but I was referring to
> squishingAllWordsIntoOneUnreadableMess vs.
> keeping_them_visually_separate_and_readable.

I like the keeping_the_visually_separate_and_readable when it used for something generic that basically "extends" the language, but SquishingWordsTogether when is a classification related to the domain, e.g.:

database.for_all_valid_entities(somelambda);

string
list!nodetype

vs

class Car…
class RacingCar…

November 10, 2014
On Mon, 10 Nov 2014 14:00:32 -0800
"H. S. Teoh via Digitalmars-d-learn"
<digitalmars-d-learn@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!


November 10, 2014
On 11/10/2014 02:00 PM, H. S. Teoh via Digitalmars-d-learn wrote:

> (I kid you not, people
> actually exist who write code like this):

I know one of those people! They are from a different era. :)

> 	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);
> 			}
> 		}

Note especially how that last brace is there to get the unwary! :)

> I think I needed therapy after encountering this. :-P

Same here! At least they used curly brackets for single-statements in the code above. In my case, they are truly optional. :(

(By the way, do you happen to know whether there are Emacs coding styles that help with that syntax? I could use one.)

Ali

1 2
Next ›   Last »