syntax of manifest enum

Robert DaSilva sp.unit.262+digitalmars at gmail.com
Wed Jan 2 15:19:57 PST 2008


This idea would have been more valuble if I came up with it before D
2.009 came out, but I still post it.

One thing that bug me is that you have to use commas instead of
semicolons. The solution that struck me was to have element in a
sequence separated by commas and unrelated items separated by
semicolons. Element that are separated by commas would have to have
homogenus type (this would prevent sudden changes of type apon switching
form an earlier version).

Examples

enum { a = 1U, b = 2 }
typeof(a) == typeof(b);

enum { a = 1; b }
b == 0;

Advantages of this syntax is that enums form version other than 2.009,
won't have their meaning changed.



More information about the Digitalmars-d mailing list