How do you think about the flooding of bracket?

Don Clugston dac at nospam.com.au
Fri Jun 16 01:32:02 PDT 2006


Derek Parnell wrote:
> On Thu, 15 Jun 2006 17:37:41 +0800, Boris Wang wrote:
> 
>> First, now, in a function of D, we can make netsted structure, nested 
>> function and versioned code block, so much brackets, which are not code 
>> block ,in the code sequence.
>>
>> Second, the use of colon and bracket for private/public, static and version 
>> keyword, make the judge of access level and storage type is difficult.
> 
>> ...
>  
>> How do you think about all these ?
> 
> I agree that the colon format for these qualifiers can lead to
> hard-to-maintain code because the scope of them is not as obvious. For that
> reason alone I avoid using them. I only use the single statement format and
> the braced format...
> 
>   private int someVar;
> 
>   static {
>      int foo;
>      int bar;
>   }
> 
> 

Another important feature of the colon is that it can appear inside 
version{} blocks. You can't do this with the {} form.

version(Windows) {

   extern(Windows):

} else {

   extern(C):

}

// These are extern(Windows) on Windows systems, but
// extern(C) on Linux.
// For example, the MySQL functions behave this way.
void func1();
void func2();




More information about the Digitalmars-d mailing list