www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Colon and Bracket

reply Sjoerd van Leent <svanleent wanadoo.nl> writes:
*LONG POST*

Hello,

Currently on the DDoc project (on dsource.org) which I am writing code 
for right now, I got struck on one specific problem. I have a question 
regarding colons and brackets (accolades).

If I specify code as the following it all goes OK:

-- code --

private:

public {

}

public:

package:

public static {

}

extern(C):

extern(Pascal) {

}

-- end code --

This can be translated into the following:

--- code ---

private {
     public {
     }
}
public {
}
package {
     public static {
     }
}
extern(C) {
}
extern(Pascal) {
}

--- end code ---

But I am not sure how D acts on the "version" statement. The following 
works quite well:

--- code ---

version(SomeVersion) {

     private:

     public {

     }

     public:

     package:

     public static {

     }

     extern(C):

     extern(Pascal) {

     }

}

--- end code ---

This translates to:

--- code ---

version(SomeVersion) {
     private {
         public {
         }
     }
     public {
     }
     package {
         public static {
         }
     }
     extern(C) {
     }
     extern(Pascal) {
     }
}

--- end code ---

But how should the following be translated?

--- code ---

version(SomeVersion):

private:

public {

}

public:

package:

public static {

}

extern(C):

extern(Pascal) {

}

--- end code ---

Should it translate as:

--- code ---

version(SomeVersion) {
     private {
         public {
         }
     }
     public {
     }
     package {
         public static {
         }
     }
     extern(C) {
     }
     extern(Pascal) {
     }
}

--- end code ---

or as:

--- code ---

version(SomeVersion) {
}
private {
     public {
     }
}
public {
}
package {
     public static {
     }
}
extern(C) {
}
extern(Pascal) {
}

--- end code ---
Oct 17 2004
next sibling parent reply Derek <derek psyc.ward> writes:
On Sun, 17 Oct 2004 12:16:33 +0200, Sjoerd van Leent wrote:

 *LONG POST*
[snip]
 But how should the following be translated?
[snip] I don't know, but I've made the decision to only use braces in my code and thus avoid any ambiguities or 'accidents'. Mixing colons and braces is just asking for trouble, IMO. -- Derek Melbourne, Australia
Oct 17 2004
parent Sjoerd van Leent <svanleent wanadoo.nl> writes:
Derek wrote:
 On Sun, 17 Oct 2004 12:16:33 +0200, Sjoerd van Leent wrote:
 
 
*LONG POST*
[snip]
But how should the following be translated?
[snip] I don't know, but I've made the decision to only use braces in my code and thus avoid any ambiguities or 'accidents'. Mixing colons and braces is just asking for trouble, IMO.
Well it is for a general documentation tool. So even if I am at your side, others may not be... Regards, Sjoerd
Oct 17 2004
prev sibling parent reply "Walter" <newshound digitalmars.com> writes:
The former. -Walter
Oct 19 2004
parent Sjoerd van Leent <svanleent wanadoo.nl> writes:
Walter wrote:
 The former. -Walter
 
 
Thanks for the information Walter. Regards, Sjoerd
Oct 19 2004