I'm trying to write some code for multiple lisp environments. For MCL I
might have something like:
#+mcl
(#_NewPtr 5)
When I try to compile this under LispWorks (4.2 Win) it complains that
"Subcharacter #\_ not defined for dispatch char #\#."
1. Is this a bug? I don't see why it would try to do anything but skip
the next form.
2. What is the best way to get around it other than setting up separate
files?
Thanks,
John DeSoi, Ph.D.
······@planetc.com (John DeSoi) writes:
> I'm trying to write some code for multiple lisp environments. For MCL I
> might have something like:
>
> #+mcl
> (#_NewPtr 5)
>
> When I try to compile this under LispWorks (4.2 Win) it complains that
> "Subcharacter #\_ not defined for dispatch char #\#."
>
> 1. Is this a bug? I don't see why it would try to do anything but skip
> the next form.
Well it may or may not be. This requires deeper delving in the CLHS.
>
> 2. What is the best way to get around it other than setting up separate
> files?
IMHO, setting up different files improves your code.
I advocate the use of a `impl-dependent' subdirectory. All your read
time conditionals can be relegated into your .system or configuration
file (where you set up logical pathnames)
Cheers
--
Marco Antoniotti ========================================================
NYU Courant Bioinformatics Group tel. +1 - 212 - 998 3488
719 Broadway 12th Floor fax +1 - 212 - 995 4122
New York, NY 10003, USA http://bioinformatics.cat.nyu.edu
"Hello New York! We'll do what we can!"
Bill Murray in `Ghostbusters'.
"Marco Antoniotti" <·······@cs.nyu.edu> wrote in message
····················@octagon.mrl.nyu.edu...
>
> ······@planetc.com (John DeSoi) writes:
>
> > I'm trying to write some code for multiple lisp environments. For MCL I
> > might have something like:
> >
> > #+mcl
> > (#_NewPtr 5)
> >
> > When I try to compile this under LispWorks (4.2 Win) it complains that
> > "Subcharacter #\_ not defined for dispatch char #\#."
> >
> > 1. Is this a bug? I don't see why it would try to do anything but skip
> > the next form.
>
> Well it may or may not be. This requires deeper delving in the CLHS.
>
The behaviour is correct. #+ binds *read-suppress* to true
and calls read.
From *read-suppress* in the CLHS:
----------------------------------
If the value of *read-suppress* is true, read,
read-preserving-whitespace, read-delimited-list,
and read-from-string all return a primary value
of nil when they complete successfully; however,
they continue to parse the representation of an
object in the normal way, in order to skip over
the object, and continue to indicate end of file
in the normal way.
----------------------------------
For example, if the definition of #| did not exist
+sometest (defun foo ( x #| ) () ) |# y ) ( + x y ))
How could the reader know when the form ended?
----------
Geoff