June 24, 2006
On Sat, 24 Jun 2006 07:55:54 +0800, Boris Wang <nano.kago@hotmail.com> wrote:
> The key is that your's pleasure is the suffering of other people!

The exact same thing can be said right back at you! :)
Regan
June 24, 2006
On Fri, 23 Jun 2006 21:31:14 -0400, Jarrett Billingsley <kb3ctd2@yahoo.com> wrote:
> "Regan Heath" <regan@netwin.co.nz> wrote in message
> news:optbmgr7jt23k2f5@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 ;)
June 24, 2006
"Regan Heath" <regan@netwin.co.nz> wrote in message news:optbmo3ih323k2f5@nrage...

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

I know that feeling!  Last fall, I suddenly found myself hating not having spaces on either side of operators and after commas.  By now most of my code has been converted to the new style, but I still find a few "a=b+c" here and there :)


June 24, 2006
"Regan Heath" <regan@netwin.co.nz> ??????:optbmgohdr23k2f5@nrage...
> On Fri, 23 Jun 2006 11:48:57 +0200, xs0 <xs0@xs0.com> wrote:
>> Regan Heath wrote:
>>> On Fri, 23 Jun 2006 17:05:15 +0800, Boris Wang <nano.kago@hotmail.com> wrote:
>>>> the harm of these is more than the benefit.
>>>>
>>>> all these syntax produce non-readable, non-maintainable codes, and even more in large project with many developers.
>>>  My vote is against removing these. I use them and prefer the : syntax
>>> for private etc within class/struct declarations.
>>
>> My vote is against having either public: or public {} :)
>>
>> With both you can't see what applies to a declaration from the declaration alone, but have to scan backwards for an arbitrary amount of lines..
>
> That doesn't bother me in the slightest (which is why I don't want them removed). I simply group all the public, protected and private methods together and use the : syntax. I can mostly tell from method name and context which access specifier any given function has (or should have) and the syntax is mostly for the compiler benefit, not mine. I definately do not want to have to put private etc in front of every single function declaration.
>
> Regan

There are many coding style here already!

Please remember, we must speek English here for communion, and not the mother-language of you.

D should be a professional language for all the programmer, not a toy of someone.

At last, there is no heaven for everyone.




June 24, 2006
Boris Wang wrote:

> 
> "Andrei Khropov" <andkhropov@nospam_mtu-net.ru> ??????:e7gs64$2ucq$1@digitaldaemon.com...
> > Mike Parker wrote:
> > 
> > > Boris Wang wrote:
> >>> the harm of these is more than the benefit.
> > > 
> > > I disagree. I like them and do not want to see them go away.
> > > 
> > > > 
> >>> all these syntax produce non-readable, non-maintainable codes, and even more  in large project with many developers.
> > > That's why large teams have coding standards. If you are going to work on a large project and something is unreadable to you, make sure your coding standards prohibit it. You'll still have to deal with it when modifying third party code, but there's nothing you can do about it.
> > > 
> > > I find the syntax quite readable and have no trouble with it. So I strongly appeal that it not be removed.
> > 
> > I agree with you.
> > I always like C++ way of declaring members instead of Java/C# way because
> > "public:" and "private:" sections visually separate interface and
> > implementation.
> > And if you want you can always establish coding standards for either
> > option.
> > 
> 
> In much C++ codes, the declaration and defination of a function is seperated, this is the main reason of colon-like syntax.
> 
> Otherwize, in no case can Bjarne Stroustrup make the colon-like syntax.

Well, I tend to agree with you.

But data declaration with group modifiers seems clearer to me anyway. So I think it is good to have both styles.

-- 
AKhropov
June 24, 2006
What you said is that, i can't has a good feeling about reading your program, just because i has not such  a editor?

In other words, you force the other readers to use the editor you use?

"Derek Parnell" <derek@psych.ward> дÈëÏûÏ¢ÐÂÎÅ:op.tbml4bwn6b8z09@ginger.vic.bigpond.net.au...
> On Sat, 24 Jun 2006 10:22:00 +1000, Boris Wang <nano.kago@hotmail.com> wrote:
>
>> And this is what ?
>>
>>>
>>>       // six pages
>>>      ...
>>>
>>>        int func3(...)
>>>        {
>>>        }
>>>        int func4(...)
>>>        {
>>>        }
>>>        int func5(...)
>>>        {
>>>        }
>>>        int func6(...)
>>>        {
>>>        }
>>>        int func7(...)
>>>        {
>>>        }
>>>        a_type var2;
>>>     }
>>>     int func2(...)
>>>     {
>>>     }
>>>     a_type var4;
>>>     int func5(...)
>>>     {
>>>     }
>>> }
>
> Excellent, that is what it is. To find out whether it is public/private/static/version/debug effected, place your cursor on the final "}" and press ctrl-[ to jump to the matching brace. This assumes you are using Crimson Editor of course ;-)
>
> The point is, writing organised and predicatable code is less costly in the long run. We also have access to tools (i.e good editors) that can help us.
>
> -- 
> Derek Parnell
> Melbourne, Australia


June 24, 2006
And this is what ?

>
>       // six pages
>      ...
>
>        int func3(...)
>        {
>        }
>        int func4(...)
>        {
>        }
>        int func5(...)
>        {
>        }
>        int func6(...)
>        {
>        }
>        int func7(...)
>        {
>        }
>        a_type var2;
>     }
>     int func2(...)
>     {
>     }
>     a_type var4;
>     int func5(...)
>     {
>     }
> }

If you can make a good enough solution for this problem, i'll give up.

> private int var;
>
> public int func( .. )
>{
>}

this syntax has no other problem, except that some people don't like it.

The codes of mango project is more beatiful than the others i readed.


"Regan Heath" <regan@netwin.co.nz> ??????:optbmn7svj23k2f5@nrage...
> On Sat, 24 Jun 2006 07:43:26 +0800, Boris Wang <nano.kago@hotmail.com> wrote:
>> "Andrei Khropov" <andkhropov@nospam_mtu-net.ru> ??????:e7gs64$2ucq$1@digitaldaemon.com...
>>> Mike Parker wrote:
>>>
>>>> Boris Wang wrote:
>>>> > the harm of these is more than the benefit.
>>>>
>>>> I disagree. I like them and do not want to see them go away.
>>>>
>>>> >
>>>> > all these syntax produce non-readable, non-maintainable codes, and
>>>> even
>>>> > more  in large project with many developers.
>>>> That's why large teams have coding standards. If you are going to work
>>>> on
>>>> a
>>>> large project and something is unreadable to you, make sure your coding
>>>> standards prohibit it. You'll still have to deal with it when modifying
>>>> third
>>>> party code, but there's nothing you can do about it.
>>>>
>>>> I find the syntax quite readable and have no trouble with it. So I
>>>> strongly
>>>> appeal that it not be removed.
>>>
>>> I agree with you.
>>> I always like C++ way of declaring members instead of Java/C# way
>>> because
>>> "public:" and "private:" sections visually separate interface and
>>> implementation.
>>> And if you want you can always establish coding standards for either
>>> option.
>>>
>>
>> In much C++ codes, the declaration and defination of a function is seperated, this is the main reason of colon-like syntax.
>>
>> Otherwize, in no case can Bjarne Stroustrup make the colon-like syntax.
>
> I don't think you can make that assertion.
>
> Like several people have said both the : and {} syntax are useful to group things together. That alone is reason enough to use them in C++ and indeed that is why/how I use them.
>
> Like Derek has just shown (to my mind) the {} syntax makes a cleaner, easier to read example, and further many editors will help further by highlighting/finding and collapsing blocks declared with either : or {} something that simply isn't possible if you specify them all in every case.
>
> Regan


June 24, 2006
On Sat, 24 Jun 2006 20:52:08 +1000, Boris Wang <nano.kago@hotmail.com> wrote:

> And this is what ?
>
>>
>>       // six pages
>>      ...
>>
>>        int func3(...)
>>        {
>>        }
>>        int func4(...)
>>        {
>>        }
>>        int func5(...)
>>        {
>>        }
>>        int func6(...)
>>        {
>>        }
>>        int func7(...)
>>        {
>>        }
>>        a_type var2;
>>     }
>>     int func2(...)
>>     {
>>     }
>>     a_type var4;
>>     int func5(...)
>>     {
>>     }
>> }
>
> If you can make a good enough solution for this problem, i'll give up.

The problem you highlight with this example does not go away with either style of coding, because without seeing the code at the matching open brace, you can't tell what the scope of the contents is. For example, your example could begin with ...

  private void xfunc() {

making all the functions nested and thus sort of private. Without actually looking, you can't tell from just seeing the end of a braced code snippet.

>> private int var;
>>
>> public int func( .. )
>> {
>> }
>
> this syntax has no other problem, except that some people don't like it.

Oh well! Get used to the idea of free choice. Coders have been given the opportunity to code using the style that find helpful or best expresses their frame of mind. And that is not intrinsically a bad thing. I won't force my style on you and I expect that you won't force your style on me, okay?

> The codes of mango project is more beatiful than the others i readed.

Yes, it is lovely code and easy to read. Well done Mango team. A lot of that has got to do with adhering to coding standards regardless of what those standards are.

-- 
Derek Parnell
Melbourne, Australia
June 24, 2006
Boris Wang schrieb:
> the harm of these is more than the benefit.
> 
> all these syntax produce non-readable, non-maintainable codes, and even more in large project with many developers.
> 
> 

I second that.

- public statement;
- public {}
This is good, easy, consistent.

- public:
is ugly C++ style and a bad choice if you can do better. And in this
case you can always use the {} form, which expands the "public" until a
defined place.

Removing it will perhaps break some existing code, but it will also make D another bit more easy.

Please also remove the inheritance protection.
June 25, 2006
On Sat, 24 Jun 2006 08:36:52 +0800, Boris Wang <nano.kago@hotmail.com> wrote:
> "Regan Heath" <regan@netwin.co.nz> ??????:optbmgohdr23k2f5@nrage...
>> On Fri, 23 Jun 2006 11:48:57 +0200, xs0 <xs0@xs0.com> wrote:
>>> Regan Heath wrote:
>>>> On Fri, 23 Jun 2006 17:05:15 +0800, Boris Wang <nano.kago@hotmail.com>
>>>> wrote:
>>>>> the harm of these is more than the benefit.
>>>>>
>>>>> all these syntax produce non-readable, non-maintainable codes, and
>>>>> even more in large project with many developers.
>>>>  My vote is against removing these. I use them and prefer the : syntax
>>>> for private etc within class/struct declarations.
>>>
>>> My vote is against having either public: or public {} :)
>>>
>>> With both you can't see what applies to a declaration from the
>>> declaration alone, but have to scan backwards for an arbitrary amount of
>>> lines..
>>
>> That doesn't bother me in the slightest (which is why I don't want them
>> removed). I simply group all the public, protected and private methods
>> together and use the : syntax. I can mostly tell from method name and
>> context which access specifier any given function has (or should have) and
>> the syntax is mostly for the compiler benefit, not mine. I definately do
>> not want to have to put private etc in front of every single function
>> declaration.
>>
>> Regan
>
> There are many coding style here already!
>
> Please remember, we must speek English here for communion, and not the
> mother-language of you.
>
> D should be a professional language for all the programmer, not a toy of
> someone.
>
> At last, there is no heaven for everyone.

Sorry, I don't understand what you're trying to say.

Regan