This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: Error in block comments
- To: guile at sourceware dot cygnus dot com
- Subject: Re: Error in block comments
- From: Chris Cramer <crayc at kiwi dot pyro dot net>
- Date: Wed, 26 Apr 2000 21:09:16 -0500
- References: <200004251937.VAA24931@faun.cs.tu-berlin.de>
On Tue, Apr 25, 2000 at 09:37:46PM +0200, Martin Grabmueller wrote:
> Block comments are not ignored inside of list and vector literals. I would
> call this a bug but I recall having read something about `block comments are
> only allowed at the beginning of script files'. I don't know where I read
> that though. Please enlighten me who is mistaken: the interpreter or me.
I see no reason why block comments should only be allowed at certain
places, with the exception of string literals. Thinking back to when
I looked at the reading code (I was trying to improve the performance,
but other things are eating up my time now...), the block comments are
discarded in scm_lreadr(), but not in the separate list reading function.
So lists, vectors, records, etc. will not allow the block comments, since
they are all read as lists and then converted into the appropriate type
as necessary. I believe it is just that the block comments can't start
right after the (, since it works like this:
something (scm_read() probably) calls scm_lreadr()
scm_lreadr() calls another function to skip whitespace (which does not
handle block comments)
scm_lreadr() tests for certain types:
for aggregates (which are all denoted by parentheses), it calls another
a list in, and converts as necessary
for block comments, it calls a strangely-optimized function to
skip the comment
numbers it will read and convert to a numeric SCM
quoted symbols it will construct a list with the quote symbol in front
etc.
The list-reading function will itself call scm_lreadr(), to read in the
elements of the list, one by one.
Anyways, block comments certainly work in places other than the beginning
of the file. It makes sense to me that they should work anywhere outside
of strings and maybe symbols, so it would be a bug.
Block comments are ugly though... #! isn't what I would pick to start a
comment, even if the OS likes #! for scripts. Should've just ignored the
first line if it started with #. But guile is just following existing
practice...
--
C. Ray C. aka Christopher Cramer
crayc@pyro.net
http://www.pyro.net/~crayc/