有哪些不同的编程语言概念以及哪些语言以纯粹的方式展示它们

发布于 2024-09-30 08:11:30 字数 709 浏览 2 评论 0原文

我不是语言专家,但我最近对语言很感兴趣,并试图了解主要概念和“他们的”语言。这类似于另一个有关书籍的问题。首先,主要的编程语言概念是什么,例如,

  • 结构化
  • 过程
  • 面向对象、
  • 面向对象 - 基于原型(例如 Java Script)、
  • 函数式(例如 Haskell)、
  • 面向逻辑(例如 Prolog)
  • 元(如果是它自己的纯粹概念?)
  • 基于堆栈(例如第四)
  • 基于数学/面向数组(例如APL)
  • 声明性
  • 连接(例如PostScript)
  • (绝对不完整的列表...)

第二个要很好地理解这些概念,基于/实现其的编程语言是什么核心理念最自然、最纯粹?

  • 例如,Java 是面向对象的,但这不是一个很好的例子,因为由于原子的原因,它不是纯粹的面向对象。
  • Lisp 是一种众所周知的函数式语言,但它是多范式的,所以它不是纯粹的。但 Lisp 可能是“基于列表”的纯粹实现(如果它算作概念的话)。
  • 是否有一种语言是结构化的(没有 GOTO)但不是过程性的? (也许 XSLT v1.x)

I am no language expert but I'm recently into languages and trying to get an overview of major concepts and "their" languages. This is similar to another question about books. So first, what are the major programming language concepts, e.g.

  • structured
  • procedural
  • object orientated
  • object orientated - prototype based (e.g. Java Script)
  • functional (e.g. Haskell)
  • logic orientated (e.g. Prolog)
  • meta (if a pure concept of it's own?)
  • stack based (e.g. Forth)
  • math based/array oriented (e.g. APL)
  • declarative
  • concatenative (e.g. PostScript)
  • (definitely incomplete list...)

and second to get a good crasp of these concepts, what would be the programming language that's based on/implementing its core concept most naturally and pure?

  • For example Java is OO, but it's not a good example because it's not pure OO due to atoms.
  • Lisp is a known to be a functional language, but it's multi-paradigm, so it's not pure. But Lisp may be a pure implementation of "list-based" (if it counts as concept).
  • Is there a language that's structured (no GOTO) but not procedural? (Maybe XSLT v1.x)

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

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

发布评论

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

评论(3

瀟灑尐姊 2024-10-07 08:11:30

您在这里寻找的术语是“编程范式”,并且有很多在那里。您可以从该维基百科页面及其后续链接获取支持每种语言的列表。

对于其中任何一个的“纯粹”演绎,这都比较困难,因为这取决于您正在寻找的纯度水平。

  • 对于纯结构化(在此处“纯”的任何足够宽松的定义下),您可以查看例如 模块-2
  • 对于纯粹的面向对象,您主要查看 Smalltalk 及其同类,如果您绝对希望所有内容都得到统一处理(在最常见的定义下实际上没有必要!)或者您正在查看像 JavaEiffel(如果您接受)该标题下的原始类型。
  • 对于功能,您最有可能在 Haskell 查找。
  • 对于逻辑编程,典型的语言是 Prolog,但它并不是真正纯粹的。我所知道的唯一(大部分)纯逻辑语言是 Mercury,而且仅当您认为其功能块与其逻辑块本质上兼容时。

...等等等等。你明白了。

The term you're looking for here is "programming paradigm" and there are a whole lot of them out there. You can get a list of languages which support each from that Wikipedia page and its follow-up links.

For "pure" renditions of any of these, that's harder because it depends on what level of purity you're looking for.

  • For pure structured (under any sufficiently-loose definition of "pure" here) you can look, for instance, at Modula-2.
  • For pure object-orientation you're looking primarily at Smalltalk and its ilk if you want absolutely everything to be uniformly treated (not actually necessary under the most common definitions!) or you're looking at languages like Java and Eiffel if you'll accept primitive types under that heading.
  • For functional you're looking most likely at Haskell.
  • For logic programming the archetypical language is Prolog, but it's not really pure. The only (mostly-)pure logic language I know of is Mercury, and that only if you view its functional chunks as being essentially compatible with its logical chunks.

...and so on and so on. You get the idea.

失退 2024-10-07 08:11:30

我认为 Pascal 是规范的过程语言。

我还认为 Lisp(讽刺的是不是 ML)是规范的“元”语言。

首先,宏是一个程序片段,它修改代表程序片段的数据结构——因此您可以使用该语言来调整该语言。其次,编写自托管解释器被认为是常见的做法,传统上称为元循环评估器:它们是编程和运行它们的程序。

当然,任何其他语言都可以做到这一点。在 Python 中,您可以访问 python 编译器,而 PyPy 是 python 中的 python 实现。但我认为 Lisp 在这方面有着最深厚的传统。

但我是一个 Lisp 门外汉,所以我知道什么......'希望这有帮助;-)

I think Pascal is the canonical procedural language.

I also think Lisp (ironically not ML) is the canonical "meta" language.

For one, a macro is a program fragment which modifies a data structure that represents a program fragment---so you use the language to tweak the language. Secondly, it's considered common practice to write self-hosting interpretors, traditionally called metacircular evaluators: they are programs which programs and run them.

Of course, any other language can do that. In Python you have access to the python compiler, and PyPy is a python implementation in python. But Lisp has, I think, the strongest tradition of doing this.

But I'm a Lisp outsider, so what do I know... 'hope-this-helps ;-)

最单纯的乌龟 2024-10-07 08:11:30

感谢只是我的正确意见的回答,我被指出了正确的方向。我将给出到目前为止我所发现的范式列表及其纯语言:

  • 命令式
    • 非结构化 --- 早期 BASIC、汇编
    • 结构化 --- ?
    • 程序性 --- ?
    • 模块化 --- Modula-2,也许是 Pascal
    • 面向对象
      • 基于类 --- Smalltalk
      • 基于原型 --- 自身,可能是 Java Script、Lua
  • 声明式 --- SQL、正则表达式、CSS
    • 逻辑 --- Mercury,也许是 Prolog
    • 函数式 ---Scheme、Haskell
      • 默认/无点
        • 串联 --- Joy、Cat

在不同的“轴”上,我们有

  • 标量 --- 大部分是
  • 数组 --- APL

不知道把它放在哪里:

  • 基于堆栈 --- Forth,Postscript

Thanks to JUST MY correct OPINION's answer I was pointed in the right direction. I will give the list of paradigms together with their pure languages as far as I found out till now:

  • imperative
    • non-structured --- early BASIC, Assembly
    • structured --- ?
    • procedural --- ?
    • modular --- Modula-2, maybe Pascal
    • object-oriented
      • class-based --- Smalltalk
      • prototype-based --- Self, maybe Java Script, Lua
  • declarative --- SQL, Regular Expressions, CSS
    • logic --- Mercury, maybe Prolog
    • functional --- Scheme, Haskell
      • tacit/point-free
        • concatenative --- Joy, Cat

On a different "axis" we have

  • scalar --- most of them
  • array --- APL

Don't know where to put it:

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