Re: What are the domains that lisp doesn't fit int?
- From: George Neuner <gneuner2/@comcast.net>
- Date: Sun, 29 Apr 2007 06:57:04 -0400
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
.
- Follow-Ups:
- Re: What are the domains that lisp doesn't fit int?
- From: Joe Marshall
- Re: What are the domains that lisp doesn't fit int?
- From: Pascal Bourguignon
- Re: What are the domains that lisp doesn't fit int?
- References:
- What are the domains that lisp doesn't fit int?
- From: fireblade
- Re: What are the domains that lisp doesn't fit int?
- From: Dan Bensen
- Re: What are the domains that lisp doesn't fit int?
- From: Pascal Bourguignon
- Re: What are the domains that lisp doesn't fit int?
- From: George Neuner
- Re: What are the domains that lisp doesn't fit int?
- From: Pascal Bourguignon
- What are the domains that lisp doesn't fit int?
- Prev by Date: Re: Any macro for inserting math "normally"
- Next by Date: Re: cl-s3: so far, so amazing
- Previous by thread: Re: What are the domains that lisp doesn't fit int?
- Next by thread: Re: What are the domains that lisp doesn't fit int?
- Index(es):
Relevant Pages
|