Writing an OS for PC
Andrew Bromage
bromage@cs.mu.OZ.AU
Wed, 31 May 1995 10:51:53 +1000 (EST)
G'day.
Francois-Rene Rideau writes:
> > (Could be kinda bias, though, I prefer assembler to all languages). So what
> > language DO you plan on using? I can't think of anything better than C than
> > assembler.
I recommend the tech report EE9240 from the Department of Electrical
and Computer Engineering, University of Newcastle, Australia. It's
called "The Case Against C". Required reading.
(Not sure where you can get it. Try ftp.newcastle.edu.au for starters.)
> Do you know FORTH ? Lisp ? ML ? Haskell ? BETA ? SELF ? Perl ? Icon ?
> Have a try !
Just a point here on efficience. Would anyone here suggest that
most of these languages could ever beat C for efficient code?
WARNING: My opinions follow.
Lisp is not bad, mostly because of all the work that has been put
into compiling Lisp. However Common Lisp (the current standard)
is large, to put it mildly. (Just take a look at CLtL2 and count
the built-in functions if you don't believe me. It's on the web
at http://www.cs.cmu.edu:8001/Web/Groups/AI/html.)
Forth is not very expressive, and is almost as bad as programming
in PostScript. (Just my opinion.)
Haskell is lazy, which constitutes a significant run-time overhead
in itself. However Haskell has the advantage that the syntax is
extremely elegant, and also that it is purely declarative. It is
also large, but for different reasons than Common Lisp.
ML is faster than Haskell, but the syntax is not very nice at all.
The problem with Perl is that it has a user base that supports it
for the wrong reasons. They like it because you can do even better
hacks than you can in TeX.
I've never programmed in BETA, SELF or Icon so I can't really comment.
WARNING: Gratuitous plug follows.
At the University of Melbourne, we are working on a new language
called Mercury. It is a logic language (like Prolog) except that
it is strongly typed (like ML and Goedel), strongly moded and
strongly deterministic. There are no non-logical constructions
(unlike Prolog) such as the cut, and I/O is completely logical
too. Now here's the good bit: Compiled code runs extremely close
to the speed of handwritten C. This is despite the fact that we
haven't written an optimiser for it yet. Once we've done some
optimisations (and they won't be basic block optimisations either;
they'll be large-scale cross-module remove-orders-of-complexity
optimisations) we expect handwritten Mercury to overtake handwritten
C in speed.
Moreover, the speed of development is fast since the compiler
detects most bugs in your code. (This is a good argument for
strict languages.) Anyone who has programmed in ML or Haskell
will know what I mean.
The moral of the story? High-level, purely declarative,
theoretically superior languages need not sacrifice efficiency.
Don't think that C is the only choice just because it generates
fast code, because while it did generate fast code for the PDP11,
that doesn't mean that it will generate fast code for the machines
of the future.
Cheers,
Andrew Bromage
---
PS: I neglected to mention that Mercury compiles to C. :-(
However, I did mention that Mercury compiles to code nearly as
fast as _handwritten_ C.