But /why/ are you copying it? That definition ought to be global and /never/ redefined... I have to conclude that you are, basically, abusing the language since the intention of enumerations (unlike subranges) was that they were purely symbolic and didn't have an implicit ordering: they were basically there as the foundation type for sets.
MarkMLl
I copy them, because i'm traslating a c header into a set header, so i can have mistakes. (allthough i will make automatic tool)
I think i'm not abusing languaje
. As you say, sets has not implicit order, but... when these are used as bitmask (a languaje facility) these are ordered.
This part (of the order in set) is the weak point as you pointed. In pascal a set can have any order, but in FPC it's stored in their set order, first, the least bit. And it's a feature of the fpc, not a bug or undocumented one.
But sets has also good advantages:
- efficient in memory and time (are well optimiced by the compiler) and do the set operations fast.
- sugar syntax.
- very strong typing.
(for example i cannot do this:
tvflags=(off,badsignal);
radioflag= (off, badsignal);
it would raise a compiler duplicate identifier, i would rename as
tvflags= (tvOff,tvBadsignal);
radioflags = (radioOff, radioBadSignal);
And well, i was tinkering on how doing things like this with sets.. And i like it