chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] More problems using with srfi-40


From: Felix Winkelmann
Subject: Re: [Chicken-users] More problems using with srfi-40
Date: Tue, 11 May 2004 07:10:43 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040113

Alejandro Forero Cuervo wrote:

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?


That's simply a bug. Sorry. I'm currently revamping the whole
extension mechanism to make it simpler and more transparent,
and in the process I stumbled upon the exact same problem
with srfi-40. Moving the macro defs into srfi-40.scm is the
right thing to do.


cheers,
felix





reply via email to

[Prev in Thread] Current Thread [Next in Thread]