appeal again: discard the syntax of private:, public: static: private{}, public{}, static{}.

Regan Heath regan at netwin.co.nz
Fri Jun 23 19:27:08 PDT 2006


On Fri, 23 Jun 2006 21:31:14 -0400, Jarrett Billingsley  
<kb3ctd2 at yahoo.com> wrote:
> "Regan Heath" <regan at netwin.co.nz> wrote in message
> news:optbmgr7jt23k2f5 at nrage...
>
>> I hate it and prefer the : syntax :)
>
> Then turn off static with the : syntax ;)

I have never needed to do that. But lets assume I need to, in that case  
I'll use {} :)

The time I tend to use private etc inline is when there is only a single  
method which requires it (a single things which differs from the others  
inside the block), eg

class A {
//implicit/explicit public:
   ..many methods..
   private int a;
}

if there were several I'd say:

class A {
//implicit/explicit public:
   ..many methods..
private:
   int a;
   int b;
}

These coding practices aren't even hard and fast rules, they've evolved  
over time* and I'm sure I break them some of the time. In addition if I'm  
working on a project with others (something I'm doing right now) I'll  
adapt my practices to the practices of the group, it's really no problem  
for me how it's written, in the end it's just more or less typing (or  
copy/paste).

I think in general the more code you read written in different ways the  
better you get at discerning the true meaning from any particular piece of  
code and the better you become as a programmer. ('you' meaning 'people in  
general' not anyone specifically)

I have had a lot of experience reading code from many people of different  
skill levels and habits, it's no longer a problem for me how it's written  
and as such I don't really care how you or anyone else writes their code.  
I tend then to write mine however I like, usually in the simplest way  
possible.

This entire thread seems to me to be about prescribing how people should  
write code and I disagree with it on principle.

Regan

*often making me wish for a program to rearrange my old code to my new  
practices ;)



More information about the Digitalmars-d mailing list