[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: succinctness = power
Anton van Straaten wrote:
>
> ...
>
> But, I took PaulG to mean that, given a program that meets all of its
> requirements, that the more succinct that the language it's written in
> allows that program to be, the more powerful that language is.
Let's have a concrete example.
Perl:
$foo || die "Foo should not be false"
Python:
if not foo:
raise ValueError("Foo should not be false.")
The Perl version has four tokens. The Python one has roughly nine.
(treat these as real exception handling cases, not assertions, Python
could tie in an assertion)
Now let's go back to the essay in question:
PaulG: "It seems to me that succinctness is what programming languages
are for. Computers would be just as happy to be told what to do directly
in machine language. I think that the main reason we take the trouble to
develop high-level languages is to get leverage, so that we can say (and
more importantly, think) in 10 lines of a high-level language what would
require 1000 lines of machine language. In other words, the main point
of high-level languages to make source code smaller."
According to this theory, the Python version is on the path back to
assembly language on the "main" metric, succinctness. If Python and Perl
were feature for feature identical languages, but the Python code base
increased by five percent because of small differences like this, Python
would be less powerful than Perl. Even if the Python one had 20% fewer
bugs, or was 15% cheaper to maintain over the long term.
Programming language design is hard, because there is no one single
factor that dominates.
> All sort of characteristics may go into allowing succinctness to be
> achieved, so it may be valid to claim that succinctness is not the "reason"
> for a language; but it seems like a valid way to measure "power", for some
> useful definition of power.
Here's your definition:
#define succinctness power
;)
PaulG defines "power" as "the ability to do what programming languages
are supposed to do." Then he says that what programming languages are
supposed to do is reduce the number of tokens or lines when compared
with machine language, the lack of a programming language. Reducing
bugs, lowering barriers, lowering per-feature cost, improving
reliability, etc. are all secondary. I disagree. I think that they are
all primary. Succinctness has no impact on the real-world except through
reducing bugs, lowering barriers, lowering per-feature cost, improving
reliability, etc. But it impacts those indirectly.
I understand that those are all hard to measure. That's why it is futile
to try to prove that one language is more powerful than another absent
real-world metrics (i.e. hours and $, not lines and tokens).
> ... Like any measurement, though, it can't really
> be taken in isolation.
>
> I see succinctness as an ultimate goal of programs and programming
> languages, and one which is worth aiming for, even if maximal succinctness
> isn't always pragmatic from a perspective of costs (time, effort, money).
Why is succinctness worth aiming for? If I could deliver a product
cheaper with a more verbose programming language, why shouldn't I? If
we're going to ground this in the real-world then we have to talk about
time and money. At that point succinctness is at best one of many means
to the desired end (along with maintainability, reliability, safety).
I'm not saying succinctness is worthless. I'm saying it is *only one
reason* among *many* to use high level programming languages.
What if I defined a programming language that was twice as verbose but
the programmers working in it were half as expensive (business majors
rather than CS) and could crank out the same number of features in the
same time (the right primitives for the problem domain). Would that high
level language be less powerful?
Paul Prescod