On Wednesday, April 09, 2014 12:18:23 w0rp wrote: > On Wednesday, 9 April 2014 at 11:39:37 UTC, Jonathan M Davis > > wrote: > > 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 > > I think this is a good idea. That way I think you'd only be able > to get undefined enum values by casting.
Exactly. - Jonathan M Davis
