Enums with integer properties (++, --) would be
nice. I sometimes like to mix integers and enums together. For example I may use
the last 8 places for a byte storage and the first part for enable/disable bit
flags. Although now D has bits included, it's still useful in things such as
file saving. ++, -- and any other integer maths would be useful on enums,
although I suppose it's possible to cast an enum to a int.
Also how
about a specific structure or extention to enums for enable disable bits. I know
that D's bits data type goses some way, but it doesn't provide a labling system
enable/disable bits. And before you point it out, you could use:
enum
EnableBit //You may reconise this from GL (Although it's missing a
few)
{
ALPHA_TEST = 1,
AUTO_NORMAL = 2,
BLEND = 4,
COLOR_MATERIAL =
8,
CULL_FACE = 16,
DEPTH_TEST = 32,
DITHER =
64,
FOG = 128,
LIGHTING
=256,
LINE_SMOOTH = 1024,
LINE_STIPPLE = 2048,
LOGIC_OP =
4096,
NORMALIZE = 8192,
POINT_SMOOTH
= 16384,
POLYGON_SMOOTH = 32768,
POLYGON_STIPPLE = 65536,
SCISSOR_TEST =
131072,
STENCIL_TEST = 262144,
TEXTURE_1D = 524288,
TEXTURE_2D =
1048576
};
EnableBit CurrentEnable;
CurrentEnable &= ALPHA_TEST;
ect...
But how about
enable EnableBit
{
ALPHA_TEST, //Auto generates the numbers
...
};
EnableBit CurrentEnable;
CurrentEnable &= ALPHA_TEST;
And even syntax sugur,
CurrentEnable.enable(ALPHA_TEST);
CurrentEnable.disable(ALPHA_TEST);
ect...
"Pavel Minayev" <evilone@omen.ru> wrote in message
news:CFN37459427319294@news.digitalmars.com...
> On Sun, 21 Jul 2002
22:32:14 -0700 Russ Lewis
> <spamhole-2001-07-16@deming-os.org>
wrote:
>
> >> > You can't use ++ and -- on enum variables
in C++... can you in D?
> >>
> >> You know, I never
thought of that. What do you think?
> >
> > I would vote no,
because I think that enums should be a different "idea
> > space" than
integers.
> >
> > I'm likely to get outvoted, though, and
that's ok.
>
> Me, I like that feature of Pascal. Makes sense
sometimes, when you
> have a set of sequential elements, and want to
traverse back and
> forth. At least it doesn't hurt in other cases.
=)
>