Subject: Re: LISP interpreter internals
From: (Rob Warnock)
Date: Wed, 18 Apr 2007 21:47:29 -0500
Newsgroups: comp.lang.lisp
Message-ID: <>
Andrew Reilly  <> wrote:
| Today I came across, and read "CONS Should Not CONS Its Arguments, Part 
| II: Cheney on the M.T.A." by Henry G Baker.
| ~hbaker1/CheneyMTA.html
| for me, that was a real eye-opener. Apparently Chicken Scheme works
| that way.

Yes, but at some cost: (1) The *entire* core interpreter (VM)
[or at least any routines that ever allocate from the heap] had
to be written in CPS, which is a royal pain (at least during
bootstrapping); (2) The performance of code compiled by Chicken
Scheme [and, yes, it's mainly a batch compiler from Scheme to C,
not primarily a interpreter per se, though it does include a full
interactive interpreter & REPL as well] is not generally as fast
[the last time I heard] as some of the other "direct-style" compilers
such as Bigloo or Stalin/Larceny.

On the other hand, advantages include (1) being able to use a
precise GC (not "conservative"), and (2) very good portablility
across platforms. <>
says it runs on "x86, x86-64, IA-64, PowerPC, SPARC and UltraSPARC,
Alpha, MIPS, PA-RISC, ARM and S/390", at least.

| Do any of the Common Lisps do anything similar?

Not that I know of, but it's certainly an interesting idea!
Though note that one of the principle motivations for Chicken
using the "CONS Should Not CONS" approach was that it greatly
simplifies the implementation of "full" Scheme-style continuations.
If that's not a strong motivator for you [and it's usually less
important for most CL implementors, since there are many forms
in CL that interfere with fully-general tail-call optimization],
then a direct-style interpreter that uses "GC_Protect" macros in
the C code [like a recent thread here noted that OCaml/Elk/etc. do]
might work just as well.

| (Not that they use C compilers as code generators...)

Well, several CL's [ECL, GCL] *do* do already *THAT*...  ;-}  ;-}


Rob Warnock			<>
627 26th Avenue			<URL:>
San Mateo, CA 94403		(650)572-2607