reflective enums

Andrei Alexandrescu (See Website For Email) SeeWebsiteForEmail at erdani.org
Thu Feb 15 21:48:15 PST 2007


Derek Parnell wrote:
> On Fri, 16 Feb 2007 00:28:42 -0500, Kevin Bealer wrote:
> 
>  
>> The Enum template ...
> 
> Now we're talking ... I wonder what 1.006 can do <G>

Probably something along the lines:

mixin ReflectiveEnum!(int, "a", "b", "c");

That generates int-based enums (enumerated values of arbitrary type will 
be possible, but hey, one thing at a time), along with parsing and 
printing code.

So it's not about what features are directly useful, but instead the 
power is in the proverbial level of indirection. I can imagine lots of 
people could care less about esoteric compile-time stuff, but they'd be 
glad to use a better enum.


Andrei



More information about the Digitalmars-d mailing list