2

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?

Robert Harvey
201k55 gold badges469 silver badges682 bronze badges
asked Oct 7, 2015 at 16:01
1
  • 4
    Swift's "enum" is actually a union type. Commented Oct 7, 2015 at 16:18

2 Answers 2

9

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).

answered Oct 7, 2015 at 16:23
1
  • 1
    In particular, you can define an enumerated type: (deftype bool () '(member true false file-not-found)) (ref. TheDailyWTF). That can be used to check the type of your values with typep. Commented Oct 7, 2015 at 16:49
1

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).

answered Feb 26, 2016 at 9:13
1
  • 2
    Can you edit in some references to back up your statement? Commented Feb 26, 2016 at 9:55

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.