哪些特征让程序员认为语言是美丽的?

发布于 2024-09-24 03:11:26 字数 106 浏览 3 评论 0原文

在我看来,有些语言通常被认为比其他语言更美丽。这似乎适用于所有编程范例。是否有任何抽象/跨范式特征使程序员认为一种语言是美丽的?

编辑:如果您认为没有达成共识,请随时发表您自己的观点

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

山有枢 2024-10-01 03:11:26

我认为美丽的是概念极简主义,或更准确地说是少数通用语言原语的正交集......

而不是描述几乎相同事物所需的许多不太强大的功能,同时必须永久考虑特殊情况。

例如,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.

醉梦枕江山 2024-10-01 03:11:26

对于美丽来说,没有任何通用的规则。情人眼里出西施——每个人都有自己对美的看法。

就我个人而言,我喜欢允许您编写简洁但不神秘的代码的语言。它表达了我的想法,没有多余的粗俗或神奇的语法。

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.

纵性 2024-10-01 03:11:26

这是我的清单:

  1. 尽可能简洁,同时仍然具有可读性。
  2. 有尽可能少的特殊情况和奇怪的规则,你“只需要知道”尽可能。
  3. 让正确、安全的方式成为最明显、最不冗长、最易读的方式。
  4. 使解决非常通用的问题变得容易。这在一定程度上与(2)密切相关。如果您必须到处考虑特殊情况,那么您的“通用”解决方案就不是很通用。
  5. 使得创建足够高效、可以在任何地方使用的抽象成为可能,而不仅仅是在不需要快速的代码中。
  6. 尽可能避免将内置类型视为“特殊”。如果内置类型可以做到这一点,那么用户定义的类型也应该能够做到。

Here's my list:

  1. Being as concise as possible while still being readable.
  2. Having as few special cases an odd rules that you "just have to know" as possible.
  3. Making the correct, safe way the most obvious, least verbose and most readable way.
  4. Making it easy to solve problems at a very generic level. This partly goes hand-in-hand with (2). If you have to consider special cases everywhere then your "generic" solutions aren't very generic.
  5. Making it possible to create abstractions that are efficient enough to be used everywhere, not just in code that doesn't need to be fast.
  6. Avoiding treating builtin types as "special" as much as possible. If builtin types can do it, then user defined types should be able to do it.
旧伤还要旧人安 2024-10-01 03:11:26

软件的总体趋势是倾向于更具声明性的语言和语言功能。目前,大多数语言都是关于如何,而不是什么。 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.

無心 2024-10-01 03:11:26

我认为它需要与自然语言有些相似。原因:人脑似乎是有线的,因此学习自然语言很容易。另请参阅本土主义,特别是乔姆斯基。这些观点有些极端,但很可能有一定道理。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文