Chris Pressey wrote:
> > A single Greek word for which there isn't an equivalent word in
> > English-- and I mean exact equivalent, including all the possible
> > meanings and nuances that this word can express in the Greek language
> > -- should be enough as an example, right?
> Unfortunately, no, it's not enough.
> A single Greek word for which there isn't an equivalent English word,
> phrase, sentence, paragraph, essay, book, or library would be enough
Which has very little relevance to programming languages. Anything
that can be done in one Turing-complete language can be done in
another Turing-complete language. The trade-off is in development
time ("expressiveness") and running time.
For a long time I've thought that the tradeoff is between ugly,
laborious and fast (C and, in the scientific community, Fortran - ugh)
and elegant, expressive and slow (Python etc). But now I'm beginning
to play with functional languages like lisp and ML. Some
implementations of these (cmucl, ocaml) are quite competitive with C
in speed (ocaml can even be faster in some circumstances), while being
orders of magnitude simpler and more elegant, and allowing far fewer
foot-shooting possibilities. No more hideous hacks to write a
function that can deal with data of any type. No more memory leaks,
no more segfaults, no more buffer overflows. And if written in purely
functional style, no "side-effect" bugs.
For example, these languages recognise a particular form of recursion
("tail recursion") that can be optimised into a regular iteration, so
you get the efficiency of a goto with the programming elegance of
And you can do things in them in a few lines that seem unthinkable in
C: eg, in ocaml, you can define a discrete derivative of an
unspecified function (a "function of a function") with
let dx = 1e-10;;
let deriv f = (fun x -> (f (x +. dx) -. f x) /. dx);;
or, for better accuracy,
let deriv f = (fun x -> (f(x +. (dx/.2.0)) -. f(x -. (dx/.2.0))) /. dx);;
Then you can get a pretty good approximation of, say, sin' (=cos):
let sin' = deriv sin ;;
sin' 0.7854 ;;
- : float = 0.707105485275860701
cos 0.7854 ;;
- : float = 0.707105482511236283
As for Lisp, its macros seem to have no equivalent in any other
language I can think of. And a lisp program can basically rewrite
itself (or generate its own functions and execute them), which would
be a hideous hack at best in any other language.
So now I'm wondering: why aren't these languages more popular? Back
in the 1970s the hardware didn't allow for efficient compilers, so I
can understand that C looked attractive, but that's no longer true.
And these languages are hardly newcomers: ML is nearly as old as C,
while Lisp dates to the 1950s.