怪异语言
怪异语言
2021年8月
当人们说根据他们的经验所有编程语言基本上等价时,他们做出的不是关于语言的陈述,而是关于他们做过的编程类型的陈述。
99.5%的编程包括将库函数调用粘合在一起。所有流行的语言在这方面都同样好。所以一个人可以很容易地花费整个职业生涯在流行编程语言的交集中操作。
但另外0.5%的编程不成比例地有趣。如果你想了解它由什么组成,怪异语言的怪异性是一个很好的线索。
怪异语言不是偶然怪异的。至少好的不是。好的怪异语言的怪异性通常暗示着存在某种不仅仅是通常的库函数调用的粘合的编程形式。
一个具体的例子:Lisp宏。Lisp宏即使对许多Lisp程序员来说也显得怪异。它们不仅不在流行语言的交集中,而且它们的性质使得在语言中正确实现它们而不将其变成Lisp的方言会很困难。宏绝对证明超越了粘合编程的技术。例如,通过首先为该类型的问题编写一种语言,然后在其中编写你的特定应用程序来解决问题。这不是你用宏能做的全部;它只是程序操作技术空间中的一个区域,即使现在还远未被完全探索。
所以如果你想扩展你对编程可能性的概念,一种方法是学习怪异语言。选择一种大多数程序员认为怪异但其中位数用户聪明的语言,然后专注于这种语言与流行语言交集之间的差异。你能用这种语言说什么,而在其他语言中说会极其不便?在学习如何说你以前不能说的话的过程中,你可能会学习如何想你以前不能想的事。
感谢Trevor Blackwell、Patrick Collison、Daniel Gackle、Amjad Masad和Robert Morris阅读草稿。
Weird Languages
August 2021
When people say that in their experience all programming languages are basically equivalent, they’re making a statement not about languages but about the kind of programming they’ve done.
99.5% of programming consists of gluing together calls to library functions. All popular languages are equally good at this. So one can easily spend one’s whole career operating in the intersection of popular programming languages.
But the other .5% of programming is disproportionately interesting. If you want to learn what it consists of, the weirdness of weird languages is a good clue to follow.
Weird languages aren’t weird by accident. Not the good ones, at least. The weirdness of the good ones usually implies the existence of some form of programming that’s not just the usual gluing together of library calls.
A concrete example: Lisp macros. Lisp macros seem weird even to many Lisp programmers. They’re not only not in the intersection of popular languages, but by their nature would be hard to implement properly in a language without turning it into a dialect of Lisp. And macros are definitely evidence of techniques that go beyond glue programming. For example, solving problems by first writing a language for problems of that type, and then writing your specific application in it. Nor is this all you can do with macros; it’s just one region in a space of program-manipulating techniques that even now is far from fully explored.
So if you want to expand your concept of what programming can be, one way to do it is by learning weird languages. Pick a language that most programmers consider weird but whose median user is smart, and then focus on the differences between this language and the intersection of popular languages. What can you say in this language that would be impossibly inconvenient to say in others? In the process of learning how to say things you couldn’t previously say, you’ll probably be learning how to think things you couldn’t previously think.
Thanks
Thanks to Trevor Blackwell, Patrick Collison, Daniel Gackle, Amjad Masad, and Robert Morris for reading drafts of this.