3 ms·
Expressivity to me is generally about code size, for a given problem does the language allow a concise solution to be expressed? The more concise the solution
by fleitz 12y ago
Expressivity to me is generally about code size, for a given problem does the language allow a concise solution to be expressed?
The more concise the solution the more expressive the language.
A language that supports 4*4 is more expressive than a language that only supports 4+4+4+4, languages that require more type information to be expressed are in general less expressive.
let add a b = a+b
is more expressive than
func add(a:IAddition, b:IAddition) -> IAddition {
return a + b;
}
where IAddition is an interface requiring the infix + operator to be defined, and the subsequent definition of said interface, where as a more expressive language will deduce the interface from the function.
Also the empty list can be expressed as a type...
class EmptyList
def empty?
true
end
end
- ssmoot 12y agoAn empty List would have to be a List first. So an Instance. But at that point you'd be facing a significant challenge to ensure it's both Immutable and still a List (or Array, whatever). But your definition of "expressive" is (IMO) backwards. Because the first example only actually expresses a label that only has meaning because you give it. It doesn't tell you if the method prints to STDOUT, concats a String, adds an Int, adds a Float to a Decimal (and how that would be achieved), etc. All that, and Ruby is (IME) more verbose than Scala (and I suspect Elixir, Erlang, Clojure, etc) for any real non-trivial example.