WithStatement for enums

Jari-Matti Mäkelä jmjmak at utu.fi.invalid
Fri May 12 14:00:43 PDT 2006


Deewiant wrote:
> How about it? Why not make WithStatement work with enums, in the manner shown
> above? I, for one, would find it handy.

Java allows enum "members" without the enum "class" name prefix in
switch-case-statements. Maybe this would be possible in D too without
greater problems:

enum X { A, B, C }

...

X x = X.A;

switch(x) {
  case A: ...
  case B: ...
}

Currently both Interfaces and Enums are a bit like second class citizens
in D. Hopefully they are "fixed" before DMD 1.0 is out. :)

-- 
Jari-Matti



More information about the Digitalmars-d mailing list