This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: SRFI package for guile, rscheme, and maybe stalin (minor questions).


Mikael Djurfeldt <mdj@mdj.nada.kth.se> writes:

> I'm not familiar with the details of SRFI-0, but I can assure you
> that the second case above is _not_ toplevel, because it is inside
> the lexical scope of the surrounding let.

Well, I was sort of wanting to take top-level as synonymous with
macroexpansion-time, but I know that's not strictly correct.  If
cond-expand really is only specified to work at the top level, that
makes it somewhat less useful.  For example, so that I could keep an
R5RS compatible implementation of srfi-1, I used a top-level let to
hide the non-public helper functions:

  (cond-expand
    (guile
      (define-public xcons #f)
      ...
    (else
      (define xcons #f))))

  (let ()
    (cond-expand
      (guile
        (define (srfi-1-error ...) ...))
      (rscheme
        (define (srfi-1-error ...) ...))
      (else
        (define (srfi-1-error ...) ...)))
    ...

    (set! xcons (lambda (a b) (cons b a))))

The problem is that if cond-expand really does have to be top-level,
then you can't have conditionally defined non-public functions.
That's unfortunate.  It means that you can't use the semi-obvious
portable solution here.

-- 
Rob Browning <rlb@cs.utexas.edu> PGP=E80E0D04F521A094 532B97F5D64E3930

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]