enum

deadalnix deadalnix at gmail.com
Fri Apr 11 12:48:24 PDT 2014


On Friday, 11 April 2014 at 12:13:20 UTC, Dominikus Dittes 
Scherkl wrote:
> Yes, but it supports enum as a separate kind of types - but 
> there are two fundamental different usages of enums, for which 
> a totaly different set of operations is required:
> 1: "real" enums, that enumerate all possible values, that can 
> be used in final switch and that shouldn't allow for any kind 
> of arithmetic performed on them - not even increment (maybe a 
> enum count, but thats all)
> 2: types with some named constants, that should NOT be usable 
> in final switch but provide arithmetic, discontinual values and 
> everything what enum at the moment falsely provides.
>
> So, D need not provide enums (both kinds can be build from 
> structs) but if it does, it should not unify them in ONE type. 
> There are too different expectations to enums as that one type 
> can satisfy them all. --> add a new type ("partial_enum" or 
> whatever) that can be used with arithmetics like flag-arrays or 
> COLOR, _and_ forbid the arithmetics for real enums.

No the first kind need language support, for thing like final 
switches.

Good now we have one that need language support and one that can 
be built as library. We are at the same point as 5 pages ago, 
let's bikeshched again for 50 pages and decide nothing now.


More information about the Digitalmars-d mailing list