What does it mean when we say that a language is expressive?
1–2 of 2 posts
Re: What does it mean when we say that a language is expressive?
#2Any Turing-complete language can do any information processing that any other can do given infinite time. If you wait long enough for it to finish, the same inputs will produce the same outputs.
So, "expressive" can't mean "capable of expressing things other languages can't" in an algorithmic sense. So then, in what sense? In the mostly subjective sense that the language makes it relatively easy in practice to specify a relatively wide variety of algorithms and data structures with the built-in language itself.
For example, a language that requires every element in an array to be of the same type and the index numbering to always start with zero would be less expressive than one that allowed elements of arbitrary size and index numbering that started with a specified value. With the former, you could still solve the problem by various means, such as using "void pointers" in the array (a void pointer can point at anything, so an array of them can point to any collection of arbitrary things), or by wrapping array access in a function that converted your index numbering to the approved zero-based numbering.
So, you could do what you wanted with either language, but one would make you build the features yourself while the "more expressive" language would have a much easier built-in way to do it (to "express" your design preferences.)
Expressiveness is subjective, because "relatively easy in practice" is in the eye of the beholder, but like "good" restaurant food, there is some amount of general agreement.
So why wouldn't every language be as expressive as possible? Because some things that are easy to express are bad ideas. You may accidentally tell the machine to do something the hard way without realizing it, because it was easier to write. Some people would prefer a language that is in a sense only half built, which they then customize with careful specifications. After all, any function that you write yourself becomes very easy in practice to use after you write it. Others would prefer what is called "batteries included" languages that have lots of pre-built functionality, since even if it is not fully customized, it will often be good enough.
Maybe that will give you a start at understanding the admittedly vague and subjective meaning of programming language "expressiveness".