From: Jecel
Subject: Re: Program "close to the machine"
Date: 
Message-ID: <4aba90d1-11d8-48fa-91d4-e226b7ee97a1@25g2000hsx.googlegroups.com>
I'll ignore the general issue of speed since that is an implementation
problem rather than a language design one. Most languages abstract
away the hardware and give you a run time environment which make
things far simpler but which limit what you can do.

The first level of low level access that we can have is full memory
manipulation. That can be available at the language level (C and
friends, Forth and assembly are the only three choices here), as a
library (remember PEEK and POKE from Basic?) or as an operating system
resource (see /dev/mem and similar in Unix style systems). The last
option is probably far too slow for practical applications that need
lots of low level access. Even the library might be slow, though if a
good compiler can inline these simple functions the generated code
might be competitive with C.

Full memory access makes it easy to mess up the run time system, so
playing nice with it is a major problem. Since the run time for C is
implemented in layers and is pretty simple, it makes it reasonable to
do this kind of thing. Another C advantage is that easily dip your
toes into low level stuff without having to dive in fully - just
taking the address of a local variable, for example, will give you a
known address in the stack and let you look around just the immediate
area.

The second level of low level access is due to resources which are not
memory mapped. I/O ports, special registers, special instructions and
so on must be implemented in assembly and presented to the high level
language as library functions. These tend to be infrequent (but very
important!) operations so performance shouldn't be an issue. Note that
in this case C doesn't have any advantage over other languages.

I see no reason not to write games, operating systems and stuff like
that in Lisp (or in my case, in Smalltalk). You just need a tiny
library plus information about the implementation.

-- Jecel