Is flags enum needed in Phobos?

Denis Shelomovskij verylonglogin.reg at gmail.com
Wed Sep 26 10:39:23 PDT 2012


25.09.2012 21:14, Denis Shelomovskij пишет:
> .NET has FlagsAttribute, Java has EnumSet. Looks like we need this too.
> How about to add a library solution to Phobos?
>
> My variant is here (search for `flagEnum`):
> https://bitbucket.org/denis_sh/misc/src/tip/stdd/typecons.d
>
> It has a bug and I have no idea how to fix it:
> `AB.init |= AB.a` and `AB.a |= AB.a` are allowed.
> (no, we can't make `AB.a` const to disallow the second case because it
> will disallow this: `auto a = AB.a; a |= AB.a;`)
>
> Also I'm not sure:
> * Should we support converting from a number to a flag enum?
> * If so, should we support values not from enum flags or throw
> exceptions (it may be configurable)?
> * Is `flagEnum` an appropriate name?
>
>
>

OK. Looks like such functionality isn't needed and I don't have to do a 
pull request. What about to close
http://d.puremagic.com/issues/show_bug.cgi?id=6946
with WONTFIX?

-- 
Денис В. Шеломовский
Denis V. Shelomovskij


More information about the Digitalmars-d mailing list