Re: What are the domains that lisp doesn't fit int?



On Sat, 28 Apr 2007 12:57:09 +0200, Pascal Bourguignon
<pjb@xxxxxxxxxxxxxxxxx> wrote:

George Neuner <gneuner2/@comcast.net> writes:

The Lisp machines, and to a lesser extent Movitz, show that CL can be
mated to and used successfully on a bare metal runtime package ... but
that has never been in dispute. In my book that's not the same as
saying CL can be used to program bare metal.

fireblade asked about lisp; you're answering about Common Lisp.

All right fine!

Common Lisp is a language, and it's powerful enough to describe
abstractly any kind of hardware and write an OS for it.

But it *isn't* powerful enough to directly program that hardware -
only to program an abstraction of the hardware. It has no support for
raw access to the hardware and no direct support for placing code or
data.

Note that with C you have the same problem: the C language is defined
abstractly, and cannot be used to implement an OS.

I didn't say anything about C, but if you want to drag it in - the
abstract machine which defines C is far closer to real hardware than
the abstract machine which defines Lisp ... any Lisp.

With two minor caveats that I will get to in a moment your statement
is not true. There is almost no OS code that could not be realized in
C ... however inefficiently.

[Before you start arguing, I don't see embedded software development
anywhere in your resume. I have almost 2 decades of experience in
high performance, hard real-time and general embedded software
development. I have implemented operating systems and language
support runtimes on bare metal.]

Virtually any register or flag manipulation required can be achieved
through judicious use of setjmp and longjmp[*]. A C application on
metal requires only a tiny bootstrap routine to set up a stack and
heap. Together with setjmp/longjmp, the total of absolutely required
assembler support for a bare metal C application is a few dozen
instructions at most. Whatever other low level support may truly be
needed - for port I/O, interrupt handling, mode switching, etc. - can
be assembled into memory by C code and executed, if necessary, via
setjmp/longjmp.

The amount of non-Lisp code needed to bootstrap Lisp is more than an
order of magnitude greater than the amount of non-C code needed to
bootstrap C.


[*] provided all the registers are saved/restored and identified in
the structure. This is the normal case for C compilers that target
bare metal.



The implementation specific runtime services you need to implement the
low-level OS stuff, you can of course implement them purely in Common
Lisp, writting in Common Lisp a compiler that generate the baremetal
binary needed.

You're intentionally obfuscating. The question is not whether Lisp
can be used to somehow assemble a runtime package that supports a Lisp
environment - the question is whether the support code itself can be
written *AS* Lisp.

The answer to that is a resounding "no". The corresponding answer for
C is "not quite, but you can get very close".

George
--
for email reply remove "/" from address
.



Relevant Pages

  • Re: Questions about a Lisp OS
    ... hardware that has to be supported, ... You have to support a huge number of cpu, chipsets, graphics cards, ... network cards, modems, usb devices, and all other kinds of hardware that ... The lisp machines and most ...
    (comp.lang.lisp)
  • Re: What are the domains that lisp doesnt fit int?
    ... mated to and used successfully on a bare metal runtime package ... ... fireblade asked about lisp; ... But it *isn't* powerful enough to directly program that hardware - ... Not Common Lisp the standard, ...
    (comp.lang.lisp)
  • SLIME 1.0-alpha released
    ... We've just released version 1.0-alpha of SLIME. ... We can now happily recommend SLIME to all the Emacs-using Lisp hackers ... except CLISP and ABCL this socket is bound to the loopback interface ... Below is a list of the Lisp implementations that we support and their ...
    (comp.lang.lisp)
  • Re: Why Lisp is not popular with average programmers
    ... > used to link directly to the hardware drivers by programs ... You can link Lisp programs to C and C++ programs, ... > Networking would have been nice for the standard to mention ... > machine code you can *make* your driver conform to that ABI ...
    (comp.lang.lisp)
  • Re: a dozen cpus on a chip
    ... No nontrivial language can ever be proven to be imposible to crash. ... compilers still available which implement ISO M2. ... It is a common misconception that Lisp is always interpretted. ... various X86 machines the hardware does exist that could allow the OS ...
    (sci.electronics.design)