I'm still having some problems using srfi-40. This time they are
very different. I got things to work by modifying the source for
the srfi-40 egg, but as this is the first time I use eggs, I'm
not sure whether this is indeed a bug or a simple error on my
part.
I create a file:
(require-for-syntax 'srfi-40)
(stream-cons 1 stream-null)
I build it (with "csc test.scm" or "csc -R srfi-40 test.scm") and
run the resulting executable. It complains:
Error: unbound variable: stream-low-level-delay
##sys#require
##sys#require
test.scm: 2 stream?
test.scm: 2 not
test.scm: 2 cons
test.scm: 2 stream-low-level-delay
srfi-40.scm from the egg, which gets installed as-is
in my registry directory, defines stream-cons using
stream-low-level-delay:
(define-macro stream-cons
(lambda (obj strm)
(let ((strm-val (gensym)))
`(make-stream
(stream-low-level-delay
(let ((,strm-val ,strm))
(if (not (stream? ,strm-val))
(stream-error "attempt to stream-cons onto non-stream")
(cons ,obj ,strm-val))))))))
stream-low-level-delay is itself a macro. It is defined in
srfi-40/base.scm, which gets compiled and installed in the
registry directori as srfi-40/base.so.
Doesn't this mean that the definition for stream-low-level-delay
is unavailable to stream-cons? stream-cons is defined in srfi-40
which, if intuition serves me right, is the file that gets loaded
when (require-for-syntax 'srfi-40) is executed.
A similar situation occurs with stream-low-level-lazy and
stream-delay.
I moved the two macro definitions (stream-low-level-*) from
srfi-40/base.scm to srfi-40.scm, updated my registry and my test
did ran successfully.
Is this a bug on the implementation for srfi-40 or an error in my
part? Am I missing something?