Talk:Ordinal data type

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Merge proposal[edit]

I propose to merge this article with Enumerated type, as it's content is not relevant enough for a separate one. Sae1962 (talk) 10:28, 29 March 2011 (UTC)[reply]

In programming languages, enumeration types exist in various forms, including ones that are intentionally not ordinal or cardinal.

Ordinality explicitly attributes the ability to order as a meaning and that for any element, it is the lesser, the same as or greater than any other element. In mathematics, ordinality also has with it the notion of being partially ordered versus completely ordered or linearly ordered and these also carry over into computer languages when dealing with ordinals.

Cardinality explicitly attributes a meaning of quantification.

Nominality explicitly attributes a meaning of identification, possibly unique. There is no suggestion of ordering or quantifying. Colors are an excellent example of nominals. Numbers on individual players in sports teams or amongst competetors in sports competitions are another. Serial numbers, assigned serially to assure uniqueness and possibly provide a means of determining other attributes, are not intended to convey ordering or quantification, only uniqueness in identification.

In programming languages, the principal reason for enumeration types is their nominality. Enumeration types may or may not posess an ordinal property. Even if a programming language's enumeration type's underlying representation could be ordered, since all binary representations ultimately can be, the ordering obtained that way might be arbitrary, utterly meaningless or, even worse, undefined and random from instance to instance. Also programming languages may sufficiently hide the underlying representation from the programmer such that having an even arbitrary, meaningless or undefined and potentially random order is difficult or impossible.

The principal attribute of enumeration types is their nominal property and the principal reason for their existance is the avoidance of so-called Magic Numbers and other ilk in software. I don't believe merging Ordinal data types with Enumeration types as though they are the same would be a Good Thing. Lind j a (talk) 00:22, 31 August 2012 (UTC)[reply]

I vote against merging. Yes, ordinal and enumerated are represented by binary patterns that can be re-interpreted as integer. But so are the character, boolean and pointer types. Of these only boolean is truly an enumerated type (but often defined with reserved keywords in programming languages). Still boolean and enumerated should be separate articles. Also, character is an kind of ordinal, still they too should be separate articles. Besides, a small article is not necessarily a bad article. David A se (talk) 22:58, 15 November 2012 (UTC)[reply]

against Not all enumerated types are ordinal, e.g. enumerated types with values assigned to it can skip values, and are then not ordinal because the mapping is not 1:1 (though the underlying type is still integer and ordinal, the enum is not)

The wording the article of mapping 1:1 to integer values is a bit confusing, the article should probably stress the fact more that the values should be consecutive. 88.159.65.6 (talk) 12:44, 21 August 2016 (UTC)[reply]