dsn@umcp-cs.UUCP (Dana S. Nau) (09/23/86)
I'm trying to get Franz Lisp to compile macros without putting (declare (macros t)) in the file being compiled. The reason why I want to do this is that my code needs to be intelligible to lisps other than just Franz, and "(declare (macros t))" seems to be pretty Franz-dependent. I thought this could be done by invoking the compiler as follows: liszt -e '(declare (macros t))' foo.l However, this didn't work--the compiler acted exactly the same as if I had typed liszt foo.l I've tried several other approaches as well, but the only thing that has worked is to do it all from Unix: (echo '(declare (macros t))' ; cat foo.l) > bar.l liszt bar.l and that seems like a real kluge. Can anyone suggest anything better? -- Dana S. Nau, Comp. Sci. Dept., U. of Maryland, College Park, MD 20742 dsn@maryland seismo!umcp-cs!dsn (301) 454-7932
cox@ucbvax.BERKELEY.EDU (Charles A. Cox) (10/02/86)
In article <3542@umcp-cs.UUCP> dsn@umcp-cs.UUCP (Dana S. Nau) writes: >I'm trying to get Franz Lisp to compile macros without putting > (declare (macros t)) >in the file being compiled. The reason why I want to do this is that >my code needs to be intelligible to lisps other than just Franz, and >"(declare (macros t))" seems to be pretty Franz-dependent. I think the easiest way would be to put the following statement in your file: #+Franz (declare (macros t)) That way only the franz reader will see the declare. Incidentally, Franz users with questions and answers like these may be interested in subscribing to "franz-friends@Berkeley.EDU". Send requests to "franz-friends-request@Berkeley.EDU" or to "...!ucbvax!franz-friends-request".
michaelm@bcsaic.UUCP (michael maxwell) (10/02/86)
In article <3542@umcp-cs.UUCP> dsn@umcp-cs.UUCP (Dana S. Nau) writes: >I'm trying to get Franz Lisp to compile macros without putting > (declare (macros t)) >in the file being compiled. The reason why I want to do this is that >my code needs to be intelligible to lisps other than just Franz, and >"(declare (macros t))" seems to be pretty Franz-dependent. > >I thought this could be done by invoking the compiler as follows: > liszt -e '(declare (macros t))' foo.l >However, this didn't work--the compiler acted exactly the same as if I had >typed > liszt foo.l > I'm not sure why this didn't work; I do something quite similar, and it works--but then there are lots of versions of Franz (ours is opus 38.91)... What I'd suggest is putting a conditional into the file, like: #+franz (declare (macros t)) We use exactly this, and it works (in our opus!). The documentation is in section 8.3.4.1 of our manual. This also exists in Common Lisp. -- Mike Maxwell Boeing Advanced Technology Center ...uw-beaver!uw-june!bcsaic!michaelm
bzs@bu-cs.BU.EDU (Barry Shein) (10/04/86)
Re: recommendation to use #+Franz I agree, it's the right answer to the question, but I just had a fun experience with something like that. I was writing a piece of code which would run equivalently on both Franz and Common lisp. To separate out the things I needed to attain compatibility I put two sections at the top, one #+Franz and the other #+Common. One of the common lisp statements used a #\c, franz could not read this and broke on the statement it was trying to ignore. My only point is, the feature is handy, but it still leaves something to be desired. I think the C-preprocessor, using only textual substitutions, still has some advantages, perhaps a cross like: #{ (arbitrary sexpr) #} A la the C pre-processor would be helpful, where the rule is if the statement evals to nil the lisp reader does read-lines until the #} is seen, rather than trying to do a (read) and throwing that away, which will fire up readmacros. Anyhow, a word to the wise...(btw, this is in no way a problem peculiar to franz lisp.) -Barry Shein, Boston University
barmar@mit-eddie.MIT.EDU (Barry Margolin) (10/05/86)
In article <708@bcsaic.UUCP> michaelm@bcsaic.UUCP (michael maxwell) writes: >In article <3542@umcp-cs.UUCP> dsn@umcp-cs.UUCP (Dana S. Nau) writes: >>I'm trying to get Franz Lisp to compile macros without putting >> (declare (macros t)) >>in the file being compiled. ... >>I thought this could be done by invoking the compiler as follows: >> liszt -e '(declare (macros t))' foo.l >>However, this didn't work ... >I'm not sure why this didn't work;.... I think I am. He should have used liszt -e '(macros t)' foo.l If Franz declare is like Maclisp declare, it means that the enclosed forms should be evaluated when the form is compiled; when a declare form is evaluated by the interpreter it is ignored completely. So, the original version passed in a declare form, which was evaluated (not compiled) and summarily ignored. -- Barry Margolin ARPA: barmar@MIT-Multics UUCP: ..!genrad!mit-eddie!barmar
dsn@umcp-cs.UUCP (Dana S. Nau) (10/14/86)
In article <3542@umcp-cs.UUCP>, I asked how one could get Franz Lisp to
compile macros without putting
(declare (macros t))
into the file being compiled. The reason for this was that the code
needed to be intelligible to Lisps other than just Franz Lisp, and
"(declare (macros t))" is unintelligible to other Lisps.
Several people sent me proposed solutions, and others wrote asking to see
these solutions. My attempts at sending direct responses haven't worked, so
I'm posting a summary to the net:
----------------
The following suggestion came from three different people:
ricks@cad.berkeley.edu (Rick L Spickelmier)
seismo!ihnp4!ihuxf!dunk (Tom Duncan)
seismo!mcvax!botter.vu44.uucp!fons (Fons Botman)
The suggestion is to use something like
#+franz (declare (macros t))
This only works in Lisps which recognize the #+ readmacro. However, this
includes all of the Lisp systems I'm using (Franz Lisp, Symbolics Zeta Lisp,
and TI Zeta Lisp). Thus, this is the solution I decided to use.
----------------
Botman also made two other suggestions.
The first suggestion was to invoke the compiler as
liszt -e '(declare (macros t))' source-file
On Opus 42.16.3, this doesn't work--the declaration is ignored. The second
suggestion was to put all the system-dependent code (including the "(declare
(macros t))" statement into a file called sysdep.l, and put
(include sysdep.l)
into the source file. This works in Franz Lisp, but not in other Lisps,
because the meaning of "include" is Franz-dependent.
----------------
topaz!think!mit-eddie!mit-athena!yba@trillian.arpa suggested that I create a
makefile which invoked "liszt < control-file" rather than "liszt
source-file". "control-file" could then include all sorts of
Franz-dependent stuff, followed by the s-expression (liszt source-file).
This approach would less be convenient than the #+franz readmacro, but it
would be more general, in the sense that it would work with Lisps which
don't recognize the #+franz readmacro.
--
Dana S. Nau, Comp. Sci. Dept., U. of Maryland, College Park, MD 20742
dsn@maryland seismo!umcp-cs!dsn (301) 454-7932