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
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-...@Berkeley.EDU". Send
requests to
"franz-frie...@Berkeley.EDU" or to
"...!ucbvax!franz-friends-request".
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
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
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:
ri...@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!y...@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.