5

私は言語の専門家ではありませんが、最近言語に興味があり、主要な概念と「それらの」言語の概要を理解しようとしています。これは、本に関する別の質問に似ています。それで、最初に、主要なプログラミング言語の概念は何ですか、例えば

  • 構造化
  • 手続き型
  • オブジェクト指向
  • オブジェクト指向-プロトタイプベース(例:Javaスクリプト)
  • 機能的(例:Haskell)
  • ロジック指向(例:Prolog)
  • メタ(それ自体の純粋な概念の場合?)
  • スタックベース(例:Forth)
  • 数学ベース/配列指向(例:APL)
  • 宣言型
  • 連結(例:PostScript)
  • (間違いなく不完全なリスト...)

そして次に、これらの概念をうまく理解するために、そのコア概念に基づいて/最も自然で純粋なプログラミング言語は何でしょうか?

  • たとえば、JavaはOOですが、アトムのために純粋なOOではないため、良い例ではありません。
  • Lispは関数型言語として知られていますが、マルチパラダイムであるため、純粋ではありません。しかし、Lispは「リストベース」の純粋な実装かもしれません(それが概念として数えられる場合)。
  • 構造化されている(GOTOはない)が手続き型ではない言語はありますか?(多分XSLT v1.x)
4

3 に答える 3

8

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.

于 2010-11-03T07:11:50.410 に答える
2

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 ;-)

于 2010-11-18T12:18:04.190 に答える
0

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
于 2011-01-14T21:18:58.003 に答える