[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Function Cell Follow-up
- To: Stanley Shebs <shebs%utah-orion@UTAH-CS.ARPA>, common-lisp@SU-AI.ARPA
- Subject: Function Cell Follow-up
- From: David C. Plummer <DCP@SCRC-QUABBIN.ARPA>
- Date: Mon, 24 Feb 86 15:00 EST
- In-reply-to: <8602241608.AA21481@utah-orion.ARPA>
Date: Mon, 24 Feb 86 09:08:37 MST
From: firstname.lastname@example.org (Stanley Shebs)
I found the discussion of rationales for function cells interesting.
The idea that different kinds of things should be allowed to have
separate name spaces seemed to be the strongest reason for function
cells, aside from compatibility.
Unfortunately, no one addressed my last two questions, which had to
do with implementing functions and values in terms of each other.
With the correct language walking tools, it is possible to transform
Scheme code into Common Lisp code. Basically, if you see
in a 'variable' position, but the lexically apparent FOO is really a
function, transform it into #'FOO. If there is no lexically apparent
FOO, then look at the global definition of function and value and pick
the one that is defined. (This has order of definition and compiler
environment problems, of course.) Conversely, if you see FOO in
functional position, e.g., as (FOO ...) and FOO's innermost lexical
definition is as a 'variable' then transform this into (funcall foo ...).
I wrote such a tool before, but I have recently learned the usage of our
code walker was somewhat incorrect, so I sometimes might generate the
As for implementing CL in Scheme, I don't have any experience, but I
think it could be done. [I learned Scheme in the '78-'79 academic year
and confess I haven't kept up on the language.] One way would be to put
the funtion on a property (a la Maclisp). There are a lot of details,
but I think function lookup is the hardest; all the rest are mostly
source level transforms.