[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ANN: Guile-Reader 0.3, A Reader Framework for Guile
From: |
Ludovic Courtès |
Subject: |
Re: ANN: Guile-Reader 0.3, A Reader Framework for Guile |
Date: |
Sat, 24 Feb 2007 17:07:30 +0100 |
User-agent: |
Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) |
Hi,
Mario Storti <address@hidden> writes:
> I'm interested in the package for use of SRFI-30 block comments. I
> tried some variations of
>
> (receive (l1 l2)
> (alternate-guile-reader-token-readers '(srfi30-block-comments))
> (fluid-set! current-reader (make-reader l1)))
>
> without success. What should be the correct `incantation'? I read the
> manual, but (I shamelessly recognize) not very deeply. I suggest a
> section in the manual "Guile reader for dummies" with instructions
> like this.
The following should work:
guile> (use-modules (system reader library))
guile> (define r (make-alternate-guile-reader '(srfi30-block-comments)))
guile> r
#<reader b7afcab0>
guile> (fluid-set! current-reader r)
guile> (r)
(+ #| this is a comment |# 2 2)
(+ 2 2)
First, you pass `make-alternate-guile-reader' a list of symbols
indicating which a list of symbols indicating the syntactic options you
want; it returns a reader, i.e., a procedure that can be used in lieu of
`read'.
Then you can install that procedure as the current reader using
`fluid-set!' as shown above. You can also pass that procedure
explicitly as a second argument to `load' so that it is used during
loading, or you can use `primitive-load' which will honor
`current-reader' (note that `load' with no second argument falls back to
using the default `read').
Now, it would probably be a good idea to have a "quick start" section in
the manual... ;-)
Thanks for your interest,
Ludovic.