enum

Jonathan M Davis jmdavisProg at gmx.com
Wed Apr 9 04:39:20 PDT 2014


On Tuesday, April 08, 2014 12:08:46 Andrei Alexandrescu wrote:
> 1. Is the current design damaging enough (= allows enough wrong/buggy
> code to pass through) to warrant a breaking tightening?

What I would very much like to see happen is that any time that any operation 
is done on a variable of an enum type and that operation is not _guaranteed_ 
to result in a valid enum value, the result should be the enum's base type and 
and not the enum type - e.g. or-ing enum flags together isn't going to result 
in a valid enum and shouldn't be typed as such, but unfortunately, it 
currently _is_ typed as such.

And I expect that the vast majority of cases where such a change would break 
code would catch bugs.

- Jonathan M Davis


More information about the Digitalmars-d mailing list