On Tuesday, 27 August 2013 at 23:52:59 UTC, captaindet wrote:
i admit that i am not very good at reading/understanding language definition syntax. but yet i think the given enum specs ( http://dlang.org/enum.html ) are not quite in order.

they seem to imply that both

enum ;
enum WhatAmI ;

You are right. Given the rules marked with asterisks below your examples would be legal.

  EnumDeclaration:
  *       enum EnumTag EnumBody
  *       enum EnumBody
          enum EnumTag : EnumBaseType EnumBody
          enum : EnumBaseType EnumBody

  EnumBody:
  *       EmptyEnumBody
          EnumMembersBody

  EmptyEnumBody:
  *       ;



Going by the description on the linked page EmptyEnumBody should probably be something like this:

  EmptyEnumBody:
          EnumMember ;

Although going by examples [2] from Andrei's book ("The D Programming Language"), it seems the following is valid:

  EmptyEnumBody:
          EnumMembers ;


2. The example from p.69 [TDPL]. It seems to be missing a colon after "enum". enum size_t g_maxDataSize = 100_000_000, g_maxMemory = 1_000_000_000;

I hope someone can clear up what is and isn't a valid enum.

Reply via email to