What are the different programming language concepts and which languages show them in a pure way

StackOverflow https://stackoverflow.com/questions/4082177

  •  28-09-2019
  •  | 
  •  

Question

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)
Was it helpful?

Solution 3

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

OTHER TIPS

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.

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top