22 Feb
2013
22 Feb
'13
4:59 a.m.
MRAB wrote:
On 2013-02-21 23:24, Greg Ewing wrote:
For example, enums in Pascal are definitely distinct types from integers, yet the language explicitly assigns them ordinal values and defines an ordering for them. Wirth must have thought there was a benefit in doing that.
It means that sets of enums can be implemented using bitsets.
That could still have been done without exposing the ordinal values. Yet, Pascal provides an ord() function. I suppose one viewpoint might be that as long as there is a defined ordering, there's always going to be at least an implied mapping to natural numbers, so there's not much point in trying to hide it. -- Greg