Re: Alternatives to C: ObjectPascal, Eiffel, Ada or Modula-3?
On Sat, 18 Jul 2009 16:19:40 +0200, Andrea Taverna wrote:
> So I have considered these alternatives: FreePascal, Eiffel, Ada and
> Modula-3.
> I have taken a look at all of them and I'm still undecided. Below are
> the impressions I got for each language. Can you help me? Feel free to
> recommend other languages as well.
These are all fine choices of languages, but I wonder how much benefit
you will be getting for yourself, as a sole-coder programming to produce
results, rather than code?
I think that you should consider stretching yourself a bit further:
others have suggested Ocaml and Hascall. I'd add that modern Common Lisp
(eg SBCL) ticks all of your boxes too. You might be surprised that there
are some scheme implementations that will fit, too, and both of those are
perhaps more "multi-paradigm" than the languages that you've got on your
short list.
In the end, though, you really need to check your decision criteria:
1: how fast is fast enough? Will you be waiting weeks for a run to
complete, or will you be coding for weeks and then running for ten
minutes? If the latter, something more expressive but perhaps a little
further from "speed of light" ASM might be more helpful. Also, if your
code will be spending most of its time in optimized library matrix
algebra code (eg atlas) then it doesn't matter much how the language
itself fares. (eg Matlab is slow but expressive unless you use it as a
wrapper around BLAS/LAPAC, in which case it's hard to get close to.)
2: How much do you really need object orientation? Inheritance isn't
necessarily particularly useful for a lot of numerical code, and there
are lighter-weight strategies that support modular and safe coding.
3: Libraries are good to have. You'll find that C and Fortran still have
the lions share of the numerical ones, though.
4: Garbage collection is really nice to have, as a programmer. Leave
this one in, but recognize that (a) you can do it in C if you want to and
(b) doing without involves more pain but can be made to work. See (1).
5: C and Fortran don't give you much of this out of the box, it's true,
but C has assert(), and used wisely and extensively in your own code will
give you some of the same "catch mistakes early" benefit of language-
supported checks, and you can turn it off with -DNDEBUG. The lisps and
schemes typically have a very wide range of "knobs" to control the amount
of run-time checking that they do.
6: C is simple and consistent.
When I had my own "C ennui" experience a couple of years ago, I picked
scheme, on the understanding that sometimes I would probably have to
still write some C and assembler to support C-using colleagues and for
ultimate performance. (And I wanted to learn something really different
from C.) I've been happy with the outcome, so far.
Cheers,
--
Andrew
|