Algol 68:雄心勃勃却未能战胜 C 的系统语言

1作者: alexandratabone9 个月前
当人们谈论可能取代 C 语言的语言时,Algol 68 很少被提及,但它可能应该被更多人关注。<p>Algol 68 于 1968 年由 IFIP 标准化,是 Algol 60 的后继者,拥有更丰富的类型系统、正交设计,以及至今仍能在现代语言中看到的功能:用户自定义类型、灵活的数组、结构化控制流,甚至在某些实现中内置了并发原语。它也能进行底层系统工作,如直接内存访问、指针运算、位运算,但具有更严格的类型检查,并且在某些编译器中还具有边界检查。<p>当时曾有人认真尝试用它来构建实际系统:IBM 大型机上的 FLACC 编译器、ICL 1900 系列上的 Algol 68R,甚至大学里也进行过操作系统内核的实验。当时的基准测试结果有时与 C 语言在相同硬件上的表现持平甚至更好。<p>那么,它为什么会衰落呢?该语言的报告以其晦涩难懂而臭名昭著(Dijkstra 称其为“一场知识灾难”),早期的编译器速度慢且不完整,而且到 70 年代中期,Unix 和 C 语言已经拥有了巨大的发展势头。Algol 68 从未获得 C 语言所享有的工具、库或市场推广支持。<p>如今看来,Rust 和 Zig 语言所被称赞的许多特性,如严格的类型、内存安全选项、用于并行处理的简洁语法,早在 50 多年前的 Algol 68 中就已经存在了。只是它没有赢得这场受欢迎程度的竞赛。
查看原文
When people talk about the languages that could have replaced C, Algol 68 doesn’t come up often but it probably should.<p>Standardized in 1968 by IFIP, it was a successor to Algol 60 with a much richer type system, orthogonal design, and features you still see in modern languages: user-defined types, flexible arrays, structured control flow, and even built-in concurrency primitives in some implementations. It could do low-level systems work too direct memory access, pointer arithmetic, bitwise operations but with stricter type checking and, in some compilers, bounds checking.<p>There were serious attempts to use it for real systems: the FLACC compiler on IBM mainframes, Algol 68R on the ICL 1900 series, and even experiments with OS kernels at universities. Benchmarks from the time sometimes matched or exceeded C on the same hardware.<p>So why did it fade? The language report was infamously dense (“an intellectual disaster” according to Dijkstra), early compilers were slow and incomplete, and by the mid-70s Unix and C had huge momentum. Algol 68 never got the tooling, libraries, or marketing push that C enjoyed.<p>Looking at it now, a lot of what Rust and Zig are praised for strict typing, memory safety options, clean syntax for parallelism was already in Algol 68 more than 50 years ago. It just didn’t win the popularity contest.