“强大”是什么意思?意思是,在讨论编程语言时?

发布于 2024-09-05 08:14:54 字数 127 浏览 2 评论 0原文

在编程语言讨论/比较的背景下,术语“能力”是什么意思?

它有明确的含义吗?即使是一个定义不明确的含义?

假设有人说“X 语言比 Y 语言更强大”或提出相同的问题,他们的意思是什么 - 或者他们想找出什么信息?

In the context of programming language discussion/comparison, what does the term "power" mean?

Does it have a well defined meaning? Even a poorly defined meaning?

Say if someone says "language X is more powerful than language Y" or asks the same as a question, what do they mean - or what information are they trying to find out?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(15

仙气飘飘 2024-09-12 08:14:54

它没有明确定义的含义。在这些类型的讨论中,“X 语言比 Y 语言更强大”通常意味着“我更喜欢 X 语言而不是 Y 语言”。另一方面,通常还会有人插话任何图灵完备语言如何完成与任何其他图灵完备语言相同的任务,因此严格来说,两者都不比另一种更强大。

我认为它的一个很好的含义是表现力。当一种语言具有很强的表达能力时,就意味着表达概念所需的代码更少。对我来说,这不仅意味着您需要编写更少的代码来完成相同的任务,而且还意味着代码易于人类阅读。当然,一般来说(在某种程度上),需要阅读的代码行数越少,人类的阅读和理解任务就越容易。

拥有一个“强大的”标准库在这里也可以发挥同样的作用。如果一种语言配备了彻底、完整的库,那么该语言中的惯用代码将能够从现有的库代码中受益,而不必在应用程序代码中重复或重新发明常见功能。最终结果还是需要编写和读取更少的代码来完成相同的任务。

我一直说“一般性”和“在一定程度上”,因为一旦语言变得过于简洁,人类就更难以解读。我想在这种极端情况下,一种语言可能仍然被认为“更强大”(甚至“太强大”)。所以我想我是说我个人对“强大”的解释也包括“有用”和“可读”的某些方面。

It does not have a well-defined meaning. In these types of discussions, "language X is more powerful than language Y" usually means little more than "I like language X more than language Y." On the other end of the spectrum, you'll also usually have someone chime in about how any Turing-complete language can accomplish the same tasks as any other Turing-complete language, so that neither is strictly more powerful than the other.

I think a good meaning for it is expressivity. When a language is highly expressive, it means less code is required to express concepts. To me, this doesn't just mean that you have to write less code to accomplish the same tasks, but also that the code is easily readable by humans. Of course, generally (to a point), having fewer lines of code to read makes the task of reading and understanding easier for humans.

Having a "powerful" standard library comes into play here along the same lines. If a language comes equipped with thorough, complete libraries, then idiomatic code in that language will be able to benefit from the existing library code and not have to repeat or reinvent common functionality in application code. The end result is, again, having to write and read less code to accomplish the same tasks.

I keep saying "generally" and "to a point", because once a language gets too terse, it gets more difficult for humans to decipher. I suppose at this extreme, a language may still be considered "more powerful" (or even "too powerful"). So I guess I'm saying my personal interpretation of "powerful" includes some aspects of "useful" and "readable" in it as well.

无风消散 2024-09-12 08:14:54

C 很强大,因为它是低级的并且可以让您访问硬件。 Python 非常强大,因为您可以快速构建原型。 Lisp 非常强大,因为它的 REPL 为您提供了绝佳的调试机会。 SQL 非常强大,因为您说出您想要的内容,DMBS 就会为您找出最好的方法。 Haskell 非常强大,因为每个函数都可以单独测试。 C++ 之所以强大,是因为它的语法结构数量是任何人需要或使用的数量的十倍。 APL 的功能非常强大,因为它可以将十个屏幕的节目压缩为十个字符。天哪,COBOL 很强大,因为……否则为什么所有银行都在使用它呢? :)

C is powerful, because it is low level and gives you access to hardware. Python is powerful because you can prototype quickly. Lisp is powerful because its REPL gives you fantastic debugging opportunities. SQL is powerful because you say what you want and the DMBS will figure out the best way to do it for you. Haskell is powerful because each function can be tested in isolation. C++ is powerful because it has ten times the number of syntactic constructs that any one person ever needs or uses. APL is powerful since it can squeeze a ten-screen program into ten characters. Hell, COBOL is powerful because... why else would all the banks be using it? :)

私野 2024-09-12 08:14:54

“强大”没有真正的技术意义,但很多人提出了建议。

一些更有趣的:

  • 如果你能用更少的代码行(或其他一些理智、合理的程序大小衡量标准)编写相同的程序,保罗·格雷厄姆(Paul Graham)希望称一种语言“更强大”。

  • Matthias Felleisen 写了一篇非常严肃的理论研究,名为 论编程语言的表达能力

作为了解并使用多种编程语言的人,我相信语言之间存在真正的差异,并且“能力”可以是描述一种语言可能比另一种语言更好的方式的便捷简写。然而,每当我听到讨论或声称一种语言比另一种语言更强大时,我往往会牢牢地捂住钱包。

"Powerful" has no real technical meaning, but lots of people have made proposals.

A couple of the more interesting ones:

  • Paul Graham wants to call a language "more powerful" if you can write the same programs in fewer lines of code (or some other sane, sensible measure of program size).

  • Matthias Felleisen has written a very serious theoretical study called On the Expressive Power of Programming Language.

As someone who knows and uses many programming languages, I believe that there are real differences between languages, and that "power" can be a convenient shorthand to describe ways in which one language might be better than another. Nevertheless, whenever I hear a discussion or claim that one language is more powerful than another, I tend to keep one hand firmly on my wallet.

萝莉病 2024-09-12 08:14:54

在编程语言中描述“能力”的唯一有意义的方式是“可以用最少的资源做我需要的事情”,其中“资源”被定义为“我宁愿不支付的任何成本”,因此可以是开发时间、CPU 时间、内存空间、金钱等。

所以基本上“功率”的定义纯粹是主观的,在任何客观讨论中都毫无意义。

The only meaningful way to describe "power" in a programming language is "can do what I require with the least amount of resources" where "resources" is defined as "whatever costs I'd rather not pay" and could, thus, be development time, CPU time, memory space, money, etc.

So basically the definition of "power" is purely subjective and rendered meaningless in any objective discussion.

天暗了我发光 2024-09-12 08:14:54

强大的意思是“权力大”。 “力量”是增加你做事能力的东西。 “事物”的形状、大小和其他事物各不相同。因此,宽松地说,当应用于编程语言时,“强大”意味着它可以帮助您快速有效地执行任务。

这使得“强大”在某种程度上得到了明确的定义,但在各个领域中并不恒定。在一个领域中强大的语言可能在另一个领域中表现不佳,例如。如果您想要进行系统级编程,C 非常强大,因为它使您可以直接访问机器、硬件和结构,使您的编码速度比汇编快得多。 C 编译器还可以生成运行速度快的紧凑代码。然而,一旦你转向 Web 应用程序,C 可能会变得非常“无能”并且严重瘫痪,因为启动和运行某些东西需要付出很大的努力,而且你必须担心许多无关的细节,例如内存等。

有时,语言是“强大的” “在多个域中。这给了他们一个普遍的“强大”标签(或徽章,因为我们在这里)。 PG 的说法是,对于 LISP,情况就是如此。这可能是真的,也可能不是。

归根结底,“强大”是一个含义丰富的词,因此您应该评估谁在说这句话、他为什么这么说以及它对您的工作意味着什么。

Powerful means "high in power". "Power" is something that increases your ability to do things. "Things" vary in shape, size and other things. Loosely speaking therefore, "powerful" when applied to a programming language means that it helps you to do perform your tasks quickly and efficiently.

This makes "powerful" somewhat well defined but not constant across domains. A language powerful in one domain might be crippling in another eg. C is very powerful if you want to do systems level programming since it gives you direct access to the machine and hardware and structures that let you code much faster than you would in assembly. C compilers also produce tight code that runs fast. However, once you move to web applications, C can become very "unpowerful" and crippling since it's so much effort to get something up and running and you have to worry about a lot of extraneous details like memory etc.

Sometimes, languages are "powerful" in multiple domains. This gives them a general "powerful" tag (or badge since were are on SO here). PG's claim is that with LISP, this is the case. That might be true or might not be.

At the end of the day, "powerful" is a loaded word so you should evaluate who is saying it, why he's saying it and what it means to to your work.

英雄似剑 2024-09-12 08:14:54

人们担心的实际上只有两个含义:

“强大”的意思是“花费更少的资源(时间、金钱、程序员、LOC等)来实现相同/更好的结果”,以及“强大”的意思“能够完成广泛的任务”。

有些语言对于小范围的任务来说非常节省资源。其他的资源利用率不高,但可以应用于广泛的任务(例如,C,通常用于操作系统开发、编译器和运行时库的创建以及与微控制器一起使用)。

当人们使用“强大”一词时,他们所想到的这两种含义中的哪一种取决于上下文(即使如此,也并不总是很清楚)。事实上,往往两者兼而有之。

There are really only two meanings people are worried about:

"Powerful" in the sense of "takes less resources (time, money, programmers, LOC, etc.) to achieve the same/better result", and "powerful" in the sense of "is capable of doing a wide range of tasks".

Some languages are extrememly resource-effective for a small range of tasks. Others are not so resource-effective but can be applied to a wide range of tasks (e.g. C, which is often used in OS development, creation of compilers and runtime libraries, and work with microcontrollers).

Which of these two meanings someone has in mind when they use the term "powerful" depends on the context (and even then is not always clear). Indeed often it is a bit of both.

浪漫之都 2024-09-12 08:14:54

通常有两种不同的含义:

  • 富有表现力,意味着代码往往非常简短且易于理解
  • 低级,意味着您对硬件有非常细粒度的控制。

对于大多数语言来说,这两个定义处于两个极端:Python 具有很强的表达能力,但级别不是很低; C 水平非常低,但表达能力不强。根据您选择的定义,语言要么强大,要么不强大

Typically there are two distinct meanings:

  • Expressive, meaning the code tends to be very short and understandable
  • Low level, meaning you have very fine-grained control over the hardware.

For the most languages, these two definitions are at opposite ends of the spectrum: Python is very expressive but not very low level; C is very low level but not very expressive. Depending on which definition you pick, either language is powerful or not powerful.

你げ笑在眉眼 2024-09-12 08:14:54

没有什么绝对没有。

对于高级程序员来说,这可能意味着内置了许多可用的数据类型。或者可能意味着可以轻松创建或遵循设计模式的抽象。

保罗·格雷厄姆(Paul Graham)是一位非常高水平的人,他是这么说的:
http://www.paulgraham.com/avg.html

Java 人员可能会告诉你一些关于可移植性,能够到达每个平台。

C/UNIX程序员可能会告诉你,它的速度和效率,完全控制每一寸内存。

VHDL/Verilog程序员会告诉你它对每个时钟和门的完全控制,从而不浪费任何电力或时间。

但在我看来,“强大的语言”支持您完成任务的所有功能。文档可能很重要,或者可能是可移植性,或者做图形的能力。它可以是任何东西,从 Assembly 编写 GUI 是愚蠢的,尝试在闪存中设计嵌入式处理器也是如此。

选择一种完全适合您需求的语言总是让人感觉很强大。

nothing absolutely nothing.

To high level programmers it might mean alot of available datatypes built in. Or maybe abstractions to easily create or follow Design Patterns.

Paul Graham is a very high level guy here is what he has to say:
http://www.paulgraham.com/avg.html

Java guys might tell you something about portability, the power to reach every platform.

C/UNIX programmers may tell you that its speed and efficiency, complete control over every inch of memory.

VHDL/Verilog programmers will tell you its complete control over every clock and gate so as to not waste any electricity or time.

But in my opinion a "powerful language" supports all of the features for you to complete your task. Documentation may be important, or perhaps it is portability, or the ability to do graphics. It could be anything, writing a gui from Assembly is just stupid, so is trying to design an embedded processor in flash.

Choosing a language that suits your needs perfectly will always feel like power.

情独悲 2024-09-12 08:14:54

我认为这个术语是营销废话,没有明确定义的含义。

如果您考虑汇编程序、C 和 C++。有时,为了满足特定的需要,人们会从 C++“下降”到 C,然后又从 C 下降到汇编语言。这使得汇编语言成为最强大的语言,因为它是唯一无所不能的语言。或者,换句话说,一行 C++ 代码可以替换几行 C 代码(例如通过函数指针隐藏多态分派),并且一行 C 代码可以替换许多汇编程序。所以 C++ 更强大,因为一行可以做“更多”的事情。

我认为当早期数据库和电子表格等产品具有内置语言(其中一些语言相当受限制)时,该术语就具有一定的流行性。因此供应商会吹捧他们的语言“强大”,因为它受到的限制较少。

I view the term as marketing fluff, no one well-defined meaning.

If you consider, say, Assembler, C, and C++. On occasions one drops from C++ "down" to C for particualr needs, and in turn from C down to assembler. So that make assembler the most powerful because it's the only language that can do everything. Or, to argue the other way, a single line of C++ code can replace several of C (hiding polymorphic dispatch via function pointers for example) and a single line of C replaces many of assembler. So C++ is more powerful because one line does "more".

I think the term had some currency when products such as early databases and spreadsheets had in-built languages, some quite restricted. So vendors would tout their language as being "powerful" because it was less restricted.

满栀 2024-09-12 08:14:54

它可以有多种含义。从最基本的意义上来说,只要是可计算的,就具有力量。从这个意义上说,最强大的语言是图灵完备,它几乎包括所有通用编程语言(与大多数标记语言和领域特定语言相反,它们通常不是图灵完整的)。

从更务实的意义上来说,它通常指的是你可以多么简洁(和可读)地做某些事情。基本上,与另一种语言相比,用一种语言完成某些任务有多容易。

哪种语言更强大(除了有些主观之外)在很大程度上取决于您想要做什么。如果您的要求是在具有 64k 内存的小型设备上运行某些内容,您可能不会使用 Java。最有可能正确的语言是 C 或 C++(或者如果您真的是核心汇编语言)。如果您需要在 1 天内完成一个非常简单的 CRUD 应用程序,也许像 Ruby On Rails 这样的东西会是一个不错的选择(我知道 Rails 是一个框架,Ruby 是一种语言,但现在可用的库和框架很大程度上取决于选择语言)

It can have several meanings. In the very basic sense there's power as far as what is computable. In that sense the most powerful languages are Turing Complete which includes pretty much every general purpose programming language (as opposed to most markup languages and domain specific languages which are often not Turing complete).

In a more pragmatic sense it often refers to how concisely (and readably) you can do certain things. Basically how easy is it to do certain tasks in one language compared to another.

What language is more powerful (besides being somewhat subjective) depends heavily on what you're trying to do. If your requirements are to get something running on a small device with 64k of memory you're likely not going to be using Java. Most likely the right language would be C or C++ (or if you're really hard core assembly). If you need a very simple CRUD app done in 1 day, maybe something like Ruby On Rails would be the way to go (I know Rails is a framework and Ruby is the language, but these days what libraries and frameworks are available factor greatly into picking a language)

半岛未凉 2024-09-12 08:14:54

我认为,也许巧合的是,功率的物理定义在这里是相关的:“工作执行的速度。”

当然,烤面包机不能很快完成灭火工作。同样,编程语言的力量也不是通用的,而是特定于它所应用的领域或任务的。 C 是一种功能强大的语言,用于编写设备驱动程序或高级语言的实现; Python 是一种用于编写通用应用程序的强大语言; XPath 是一种用于在结构化数据集上编写查询的强大语言。

因此,给定一个问题领域,一门语言的威力可以说是有能力的程序员能够使用它来解决该领域问题的速度

I think that, perhaps coincidentally, the physics definition of power is relevant here: "The rate at which work is performed."

Of course, a toaster does not perform very quickly the work of putting out fires. Similarly, the power of a programming language is not universal, but specific to the domain or task to which it is being applied. C is a powerful language for writing device drivers or implementations of higher-level languages; Python is a powerful language for writing general-purpose applications; XPath is a powerful language for writing queries on structured data sets.

So given a problem domain, the power of a language can be said to be the rate at which a competent programmer is able to use it to solve problems in that domain.

冷了相思 2024-09-12 08:14:54

通过不假设定义“强大”(在语言上下文中)的元素来自如此多的维度,可以尝试得出精确的答案。

看看有多少可能,并且会缺少很多:

  • 运行时速度
  • 代码大小
  • 表现力
  • 支持的范式
  • 开发/调试 时
  • 域专业化
  • 标准库
  • 代码库
  • 工具链生态系统
  • 可移植性
  • 社区
  • 支持/文档
  • ​​流行度
  • (此处添加更多)

这些和更多参数汇集在一起​​ X 图片“用某种语言编程”在 X 级别会是什么样子。但这只是定义,唯一真正的知识来自于使用该语言的实际实践,但我离题了。

问题归结为哪个参数将代表语言的内在质量。如果您指的是语言本身,那么它最终的内在目的是“表达事物”,因此最具代表性的参数理所当然表现力< /em>,当有人谈论一种语言有多么强大时,这也是经常引起共鸣的。

目前你试图扩大问题/答案的范围,以涵盖“作为一种语言、作为一种舌头”的语言表达能力,你更多地谈论不同种类的“环境”,社会环境、发展环境、商业环境等等。

根据要定义的环境的复杂性,您将不得不混合更多来自多个、巨大的、重叠的、有时甚至是矛盾的维度的参数,最终将失去获得定义的意义,或者问题将变得更加复杂。被缩小。

这种近似仍然无法回答“什么是表达性语言”,但同样,一个共同的理解是 Vineet 在其答案中很好地指出的定义,以及 Forest 在评论中评论的定义。我同意,对我来说“表达”就是“传达意义”。

A precise answer can be tried to reach, by not assuming that the elements that define "powerful" (in the context of languages) come from so many dimensions.

See how many could be, and a lot will be missing:

  • runtime speed
  • code size
  • expressiveness
  • supported paradigms
  • development / debugging time
  • domain specialization
  • standard libs
  • codebase
  • toolchain ecosystem
  • portability
  • community
  • support / documentation
  • popularity
  • (add more here)

These and more parameters draw together X picture of how "programming in some language" would be like at X level. That will be only the definition, though, the only real knowledge comes with the actual practice of using the language, but i digress.

The question comes down to which parameter will represent the intrinsic quality of a language. If you refer to a language in itself, its ultimate, intrinsic purpose is "express things", and thus the most representative parameter is rightfully expressiveness, and is also one that resonates frequently when someone talks about how powerful a language is.

At the moment you try to widen the question/answer to cover more than the expressiveness of the language "as a language, as a tongue", you are more talking about different kinds of "environment", social environment, development environment, commercial environment, etc.

Depending of the complexity of the environment to be defined you'll have to mix more parameters that come from multiple, vast, overlapping and sometimes contradictory dimensions, and eventually the point of getting the definition will be lost or the question will have to be narrowed.

This approximation still won't answer "what is an expressive language", but, again, a common understanding are the definitions that Vineet well points out in its answer, and Forest remarks in the comments. I agree, for me "expression" is "conveying meaning".

坚持沉默 2024-09-12 08:14:54

我记得大学里的许多老师都称他们所教授的任何语言都是“强大的”。

让我思考:

强大=一个相对术语,将最新的编码方式与原始或以前的方式进行比较。

I remember many instructors in college calling whatever language they were teaching "powerful".

Leads me to think:

Powerful = a relative term comparing the latest way to code something vs. the original or previous way.

惟欲睡 2024-09-12 08:14:54

我发现在讨论任何与软件相关的事情时使用“强大”这个词是没有用的。每当我的大学教授引入一个新概念(例如多态性)时,他都会说“所以这是一个非常强大的功能”。过了一会儿我就生气了。如果一切都强大,那么什么都没有。都是一样的。您可以编写代码来执行任何操作。需要多少代码来完成这件事真的很重要吗?你可以说它很短或很高效,但强大却毫无用处。核能的威力很强大。代码就是文字。

I find it useless to use the word "powerful" in regards to discussing anything software related. Every time my professor in college would introduce a new concept such as polymorphism he would say "so this is a really powerful feature". After a while I got annoyed. If everything is powerful then nothing is. It's all the same. You can write code to do anything. Does is really matter how much code is required to do it? You can say it's short or efficient but powerful is just useless. Nuclear energy is powerful. Code is words.

羁绊已千年 2024-09-12 08:14:54

我认为功率通常指的是它处理数据的速度,例如我发现在 python 中,一旦列表的长度超过大约。 2000 它变得慢得难以忍受,而在 C++ 中,列表可以轻松包含 20,000 个条目,而不这样做。

I think that power would normally refer to how quickly it can process data, for example I found that in python as soon as a list exceeds a length of approx. 2000 it becomes unbearably slow whereas in C++ a list can easily contain 20,000 entries without doing so.

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