Design of reflective enums

Michiel nomail at please.com
Mon Feb 19 12:06:17 PST 2007


Andrei Alexandrescu (See Website For Email) wrote:

>> Well I think that Ada does it in the core language (but I think that
>> they are not printable), it is able to define enum as an index array
>> as you suggest in your second email.
>> As the more I look at D, the more I find it similar to Ada, it is
>> perhaps a good idea to make them those enhanced enum in the core
>> language, and as an improvement to Ada those enum should be printable
>> (maybe as an option to save memory) .
> 
> On the contrary, I think it would be great if it were _not_ in the core
> language, and I'd be happy if a library enum was so good, it would cause
> deprecation of the built-in one.

That's a strange thing to hope for. There are advantages to having a
feature in the core language instead of a library. Several of them are
summed up on the website. In this case:

* The syntax will be nice and clean.
* The compiler knows exactly what you mean and can optimize accordingly.

Those are not true of library implementations.

-- 
Michiel



More information about the Digitalmars-d mailing list