Question

I'm reading about Swift enum's in the Swift Programming Language guide and the text was comparing the differences between Swift's enum and C's enum. This made me curious as to where enumerations came from originally. I did search online before asking and even asked a few people and they assumed C. (I suppose I'm trying to confirm if enumerations came from C originally.)

What was the first programming language to include enumerations?

Was it helpful?

Solution

Probably Lisp (1958).

In Lisp dialects, symbols can be used in the same way as C's enumerations. Indeed, the Wikipedia page for Symbol (Programming) says:

In the most trivial implementation, [symbols] are essentially named integers (e.g. the enumerated type in C).

Scheme and Common Lisp have a member function, which can be used like:

(member 'b '(a b c))
;=> (b c)

Fortran also has an enumeration type, but it looks like it was added in Fortran2003 for compatibility with C's enum, which itself was only added in ANSI C (1989).

OTHER TIPS

In the strict sense, the answer is probably Pascal. Pascal certainly had enumerated types before C did. Algol 60, Algol W, Burroughs Algol, Simula 67, and Algol 68, Pascal's more noteworthy predecessors, did not. In a somewhat weaker sense, COBOL "88-level" definitions are not completely utterly and entirely unlike enumerations; you could say that the germ of the idea was there (more than in Lisp).

Licensed under: CC-BY-SA with attribution
scroll top