Strongly typed enums
bearophile
bearophileHUGS at lycos.com
Thu Aug 25 18:46:22 PDT 2011
Adam Ruppe:
> I think I'm for this. If you provide a name with no base type,
> it should work like this.
Why do you suggest to disallow implicit conversions (and use strong typing) only if the enum definition doesn't specify a base type?
> Bearophile, have you considered making a pull request?
I think I am not able to do that yet.
> I imagine if any code breaks, it'd be easy enough to fix with
> changing to the item or inserting a cast.
Recently I have discussed safe enum conversions too. In some cases it's good to replace cast() with a to!.
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=142862
Bye,
bearophile
More information about the Digitalmars-d
mailing list