What do you mean by the expressiveness of a programming language?

前端 未结 11 1755
眼角桃花
眼角桃花 2021-01-31 07:56

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.

  • Is it
11条回答
  •  后悔当初
    2021-01-31 08:17

    If you want an answer that's somewhat theoretical but more rigorous than most, you might want to look around for Matthias Felleisen's On the Expressive Power of Programming Languages. I'm pretty sure a bit of looking around the net will turn up at least a few copies.

    If you want a more practical answer of what most people really mean when they say it, that's, frankly, rather different. Usually, at least in my experience, an "expressive" language means: "I like the language, but can't cite any objective support for doing so." Conversely, things like "less expressive", or "not expressive" generally mean: "I don't like the language [as well], but can't cite any objective support for doing so."

    "Not expressive" is often similar to a politician accusing another of being "fascist" -- clearly pejorative, but without any meaningful definition of what's supposedly wrong.

    One of the big problems stems from a fundamental difference of opinion. There are at least two fundamentally different general ideas that people seem to have about expressiveness:

    1. the ability to express a wide variety of ideas.
    2. the ability to express some specific ideas clearly (and often succinctly).

    To consider some extreme examples, assembly language would qualify as highly expressive by the first criteria--you can do essentially anything in assembly language that you can in a higher level language, and you can do some things in assembly language that you can't in essentially any higher level language.

    Obviously, assembly language doesn't look nearly so good by the second measure--it typically requires quite a large amount of fairly opaque code to accomplish much of anything. This measure would tend to favor a language like Haskell or APL, to give only a couple of examples.

    These two notions of what "expressive" means are frequently close to diametrically opposed. The first tends to favor the "lowest" level languages, while the second tends to favor the "highest" level. By combining the two, it's pretty trivial to choose a definition that "proves" that a language of your choice is the most expressive.

提交回复
热议问题