On 06/11/2013 12:52 PM, Seany wrote:

> i read here that enums, once initialized, are constants :
> http://ddili.org/ders/d.en/enum.html

enum is a type definition with a limited set of values. That part cannot be changed at runtime. (A type is a compile-time concept in D.)

Of course then there are variables of an enum. Their values can change but they can take only those limited set of values. (A cast can be used to have invalid enum values. Not recommended. ;))

> However, i need a method, if possible, to dynamically (cexecution time)
> definition of enums, and updating them.

If you are talking about changing the set of values, then it is not possible with enums at runtime. You must represent that "type" some other way. For example, you can have an associative array that you can add values to.

Ali

Reply via email to