Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 the verboseness/succinctness? I mean, if one language can write down something shorter than the other, does that mean expressiveness? Please refer to my other question - Article about code density as a measure of programming language power
  • Is it the power of the language? Paul Graham says that one language is more powerful than the other language in a sense that one language can do that the other language can't do (for example, LISP can do something with macro that the other language can't do).
  • Is it just something that makes life easier? Regular expression can be one of the examples.
  • Is it a different way of solving the same problem: something like SQL to solve the search problem?

What do you think about the expressiveness of a programming language? Can you show the expressiveness using some code?

What's the relationship with the expressiveness and DSL? Do people come up with DSL to get the expressiveness?

like image 219
prosseek Avatar asked Mar 11 '10 18:03

prosseek


1 Answers

Personally, I feel that the "expressiveness" of a language really comes down to how clearly the language constructs can "express" the developer's intentions.

For example, I feel that C# (especially LINQ via C# 3+) is becoming much more expressive. This LINQ statement is a great example:

var results = collection.Where(item => item > 5); 

Without knowing the details of the language or the implementation being used, the developer intent is (in my opinion) very clear in the above statement.

I do not think that the verboseness of the language is equal to its expressiveness, however, there is some correlation in place. If a language requires a lot of code in order to express an abstraction, it is less expressive. These are two related, but different, concepts.

The same is true with power - although here a language's features (ie: power) must be complete enough to express the abstraction clearly. Without this, expressiveness will suffer. That being said, a language can be very "powerful" in terms of features, but not necessarily be expressive, if the feature set is difficult to understand.

like image 139
Reed Copsey Avatar answered Nov 04 '22 16:11

Reed Copsey