哪些特征让程序员认为语言是美丽的?
在我看来,有些语言通常被认为比其他语言更美丽。这似乎适用于所有编程范例。是否有任何抽象/跨范式特征使程序员认为一种语言是美丽的?
编辑:如果您认为没有达成共识,请随时发表您自己的观点
It seems to me that some languages are generally being conceived as more beautiful than others. This seems to apply to all programming paradigms. Are there any abstract/paradigm-spanning characteristics which makes programmers consider a language as beautiful?
Edit: If you think that there is no consensus then please don't hesitate to state your own views
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我认为美丽的是概念极简主义,或更准确地说是少数通用语言原语的正交集......
而不是描述几乎相同事物所需的许多不太强大的功能,同时必须永久考虑特殊情况。
例如,Haskell 基本上只是围绕三个原语 使用一个非常小的类型系统(只有值、泛型、构造函数、类型类),它以一种强大的方式涵盖了所有内容,可能没有其他通用语言可以实现。
再次值的概念涵盖了一切 - 数据、函数、对象(作为值的集合)……
另一方面,经典 VB 甚至有超过五种构建循环的方法-在。值和函数、普通数据和对象之间存在差异,...整个过程几乎没有任何编写通用代码的可能性。
What I consider beautiful is conceptual minimalism or more precisely an orthogonal set of few general language primitives ...
as opposed to many less powerful features needed to describe almost the same thing, while permanently having to consider special cases.
Haskell for example is basically just some syntax around three primitives with an incredibly small type system (just values, generics, constructors, typeclasses) that covers everything in such a powerful way that maybe no other common language can achieve.
The notion of a again value covers everything - data, functions, objects (as a collection of values), ...
Classic VB on the other side has even more than five ways of looping built-in. There is made a difference between values and functions, plain data and objects, ... And the whole almost without any possibility of writing generic code.
对于美丽来说,没有任何通用的规则。情人眼里出西施——每个人都有自己对美的看法。
就我个人而言,我喜欢允许您编写简洁但不神秘的代码的语言。它表达了我的想法,没有多余的粗俗或神奇的语法。
There aren't any universal rules for beauty. Beauty is in the eye of the beholder - everyone has their own idea of beauty.
Personally I like languages that allow you to write code that is concise but not cryptic. It expresses what I am thinking with no extra cruft or magic arcane syntax.
这是我的清单:
Here's my list:
软件的总体趋势是倾向于更具声明性的语言和语言功能。目前,大多数语言都是关于如何,而不是什么。 for 循环准确地表明了您希望代码的行为方式,但它并不表明您希望发生什么。
对我来说,一门美丽的语言可以让我在不剥夺优化能力的情况下进行声明。您的代码表现力越多越好。
There is a general trend in software towards languages and language features that are more declarative. At the moment most languages are all about the how, not about the what. A for loop indicates exactly how you want the code to behave, but it doesn't indicate what you want to happen.
To me a beautiful language is one that allows me to be declarative while not taking away the ability to optimize. The more expressive you can be in code, the better.
我认为它需要与自然语言有些相似。原因:人脑似乎是有线的,因此学习自然语言很容易。另请参阅本土主义,特别是乔姆斯基。这些观点有些极端,但很可能有一定道理。
I think it needs to be somewhat similar to a natural language. Reason: the human brain seems to be wired so learning natural languages is easy. See also Nativism, and specially Chomsky. Those are a bit extreme views, but there is most likely some truth to it.