enum inheritance
JS
js.mdnq at gmail.com
Mon Jul 15 11:26:25 PDT 2013
On Monday, 15 July 2013 at 13:47:10 UTC, Dicebot wrote:
> On Monday, 15 July 2013 at 13:01:05 UTC, JS wrote:
>> ...
>
> I see. No, unfortunately, I am currently not aware of a way to
> make symbol act as type and and value at the same time.
>
> However it is worth noting that you use plenty of excessive
> attributes. Currently it is not a compiler error but makes code
> much harder to read and confusing. For example, "final" has no
> meaning for structs as they can't be inherited from anyway.
> Duplicating immutable is also excessive because it is
> transitive.
Original I had it as a class. I'm not sure if it matters much
between a class and a struct though?
In any case, I solved this problem by using an attribute to test
instead of using isMutable. Obviously this requires adding a
symbol but not a huge deal.
e.g.,
@Enum immutable struct ...
and hasAttribute(T, Enum) replaces isMutable(T).
More information about the Digitalmars-d-learn
mailing list