"MIURA Masahiro" <echocham...@gmail.com> wrote in message 
news:gp730i$30e...@digitalmars.com...
> In D2:
>
> enum Shape: string
> {
>    Square = "Square",
>    Circle = "Circle",
> }
>
> void main()
> {
>    assert(cast(string) Shape.Square == "Square");
> }

So there's no built-in way to do this with compile-time reflection?

I suppose I could work around it by creating a mixin that automatically 
generates both the enum and an enum->string routine. 


Reply via email to