第一种使用枚举的编程语言是什么?

What was the first programming language with Enumerations?

我正在阅读 Swift Programming Language 指南中有关 Swift enum 的内容,其中的文字比较了 Swift 与 enum 之间的差异和 C 的 enum。这让我很好奇枚举最初是从哪里来的。我在问之前确实在网上搜索过,甚至问过几个人,他们假设 C。(我想我想确认枚举是否最初来自 C。)

问题

第一种包含枚举的编程语言是什么?

Pascal 有枚举类型,但没有使用关键字 enum。据我所知,关键字 enum 最先由 C 使用,但这个概念要老得多。

有关示例,请参阅 Enumerated type 上的维基百科,例如:

type
  cardsuit = (clubs, diamonds, hearts, spades);
  card = record
           suit: cardsuit;
           value: 1 .. 13;
         end;
var
  hand: array [ 1 .. 13 ] of card; 
  trump: cardsuit;

我认为 Pascal 是维基百科页面上列出的最古老的语言。所指的 LISP 是 Common Lisp,它晚于 Pascal,尽管原始 LISP 很容易早于 Pascal。

The Programming Language Pascal from 1970 lists these types in section 6.1.1 Scalar Types, so for all practical purposes, these enumerated types have always been a part of Pascal. See the documents page at the Standard Pascal web site. The revised report is also available there (1972), and is probably the more widely read document. You can also track Pascal 当然在维基百科上。

(可能还有另一种具有类似功能的早期语言;我没有确定它,但我没有到处找。不过,Algol-60 不是这样的语言;Fortran 也不是或 Cobol。Algol-68 和 PL/1 是可能的竞争者。)

Algol 68 没有枚举。 PL/I 没有枚举。 历史悠久的 Lisp 根本没有编译时类型的概念。 Algol W 和 Simula 67 没有枚举。说来也怪, COBOL 不仅是一个可能的竞争者,而且是最有可能的 一。并不是说它有用户可定义的类型,而是查一下 “88级”。 Burroughs Algol的宏观设施, SAIL、CORAL 66 和 RTL/2 可用于为数字命名, 这几乎可以让您了解 C 相当破损的枚举。