>> Set's aren't arrays, they are bitfields. As such there is no intrinsic
>> ordering
>> of the items.
> Of course there is! that is why does Ord(MySet(i)) works
That's it's position in the enumeration not the set... they are different
things... The enumeration is a list of values bound to identifiers.
a set is a collection of some, all or none of those values. There is
no record of the order in which the items were added or stored...
> The problem is that the Set is 256 bits so Ord can't map it into a valid
> type
come again... The set size is a bit field with 1 bit for each element padded
out to the nearest 8 bits. hence a set for a 13 element enumeration is 13 bits
but is stored in 16bits... This has absolutely nothing to do with type safety.
> Maybe we need a SmallSet type (32 or 64 elements only)
I aggree that 256 elements is a small limit... It would be nice if Borland
dropped these archaic limits... However it's rare to need more than 256
elements in an enumeration set... Parser tokens or integer ranges are
possible exceptions of course.
--
Aaron Scott-Boddendijk
Jump Productions
(07) 838-3371 Voice
(07) 838-3372 Fax
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz