On Thu, 29 Oct 2009 22:16:13 -0500, Stewart Gordon <smjg_1...@yahoo.com> wrote:

Phil Deets wrote:
I would definitely like the following code to work.
 enum Tag
{
   A, B, C,
   version (5) {
      D, E,
   }
   version (7) {
      F, G,
   }
   // ...
}

So would I, except that it makes more sense to me to have the trailing comma after the '}'. Commas separate, unlike semicolons, which terminate.


I put the comma inside the version block because then there wouldn't be duplicate commas if the version was removed. If the version number was 6 in the above example, it would evaluate to "A, B, C, D, E," with my way, but

enum Tag
{
   A, B, C,
   version (5) {
      D, E
   },
   version (7) {
      F, G
   },
   // ...
}

would evaluate to "A, B, C, D, E, ," which has two commas in a row. However, you could keep version blocks separated with commas if you specialized the enum grammar specifically for version blocks, which might be the right way to go.

Reply via email to