编程语言的表现力是什么意思? [英] What do you mean by the expressiveness of a programming language?

查看:97
本文介绍了编程语言的表现力是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当人们想强调一种语言比另一种语言更好时,我会看到很多表达性"一词.但是我不明白它们到底是什么意思.

I see a lot of the word 'expressiveness' when people want to stress one language is better than the other. But I don't see exactly what they mean by it.

  • 这是冗长/简洁吗?我的意思是,如果一种语言可以写下比另一种语言简短的内容,这是否意味着表达能力?请参考我的其他问题-有关代码的文章密度作为编程语言能力的度量
  • 这是语言的力量吗?保罗·格雷厄姆(Paul Graham)说,某种语言比另一种语言更强大,因为某种语言可以做到另一种语言无法做到的(例如,LISP可以用宏来执行另一种语言不能做到的事情). /li>
  • 仅仅是让生活更轻松的事情吗?正则表达式可以是示例之一.
  • 解决相同问题的方式是否不同:像SQL这样的解决搜索问题的方法?
  • Is it the verboseness/succinctness? I mean, if one language can write down something shorter than the other, does that mean expressiveness? Please refer to my other question - Article about code density as a measure of programming language power
  • Is it the power of the language? Paul Graham says that one language is more powerful than the other language in a sense that one language can do that the other language can't do (for example, LISP can do something with macro that the other language can't do).
  • Is it just something that makes life easier? Regular expression can be one of the examples.
  • Is it a different way of solving the same problem: something like SQL to solve the search problem?

您如何看待编程语言的表现力?您可以使用一些代码来显示表现力吗?

What do you think about the expressiveness of a programming language? Can you show the expressiveness using some code?

与表现力和DSL有什么关系?人们会想出DSL来获得表现力吗?

What's the relationship with the expressiveness and DSL? Do people come up with DSL to get the expressiveness?

推荐答案

我个人认为,一种语言的表现力"实际上归结为该语言结构可以表达"开发者意图的清晰程度.

Personally, I feel that the "expressiveness" of a language really comes down to how clearly the language constructs can "express" the developer's intentions.

例如,我觉得C#(尤其是通过C#3+的LINQ)正变得更具表现力.此LINQ语句是一个很好的例子:

For example, I feel that C# (especially LINQ via C# 3+) is becoming much more expressive. This LINQ statement is a great example:

var results = collection.Where(item => item > 5);

在我不知道所用语言或所用实现的细节的情况下,在我看来,开发人员的意图在上述声明中非常清楚.

Without knowing the details of the language or the implementation being used, the developer intent is (in my opinion) very clear in the above statement.

我认为语言的冗长程度不等于其表达能力,但是存在一定的相关性.如果一种语言需要大量代码来表达抽象,那么它的表现力就较差.这是两个相关但不同的概念.

I do not think that the verboseness of the language is equal to its expressiveness, however, there is some correlation in place. If a language requires a lot of code in order to express an abstraction, it is less expressive. These are two related, but different, concepts.

功能也是如此-尽管此处的语言功能(即:功能)必须足够完整才能清楚地表达抽象.没有这一点,表现力将受到损害.话虽这么说,如果功能集难以理解,一种语言就功能而言可能非常强大",但不一定具有表达力.

The same is true with power - although here a language's features (ie: power) must be complete enough to express the abstraction clearly. Without this, expressiveness will suffer. That being said, a language can be very "powerful" in terms of features, but not necessarily be expressive, if the feature set is difficult to understand.

这篇关于编程语言的表现力是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆