> I am getting an error when trying to load a file with R7RS library > declarations that includes cond-expand clauses. > > Here is an example: two files > > test.scm: > > (cond-expand > (chicken (begin (define is-chicken? #t))) > (else (begin (define is-chicken #f)))) > > test.sld: > > (import r7rs) > > (define-library (test) > (import (scheme base)) > (include-library-declarations "test.scm") > (export is-chicken?)) > > Trying to load it with `csi test.sld` gives > > > Error: (define-library) during expansion of (define-library ...) - invalid > > library declaration: ((##core#begin (##core#begin (define is-chicken? #t)))) > > > > Call history: > > > > <syntax> (##core#quote #f) > > <eval> (chicken.load#load-unit (##core#quote library) (##core#quote > > #f) (##core#quote #f)) > > <eval> (chicken.load#load-unit (##core#quote library) (##core#quote > > #f) (##core#quote #f)) > > <eval> (chicken.load#load-unit (##core#quote expand) (##core#quote > > #f) (##core#quote #f)) > > <syntax> (import-syntax chicken.base chicken.fixnum > > chicken.platform chicken.flonum (except scheme string-cop... > > <syntax> (##core#undefined) > > <syntax> (##core#undefined) > > <syntax> (##core#undefined) > > test.sld:1 (##core#begin (##core#require r7rs r7rs)) > > test.sld:1 (##core#require r7rs r7rs) > > <syntax> (chicken.load#load-extension (##core#quote r7rs) > > (##core#quote #t) (##core#quote #f)) > > <syntax> (##core#quote r7rs) > > <syntax> (##core#quote #t) > > <syntax> (##core#quote #f) > > <eval> (chicken.load#load-extension (##core#quote r7rs) (##core#quote > > #t) (##core#quote #f)) > > test.sld:3 (define-library (test) (import (scheme base)) > > (include-library-declarations "test.scm") (export is-c... <-- > > The following, which should be equivalent, works: > > test2.sld: > > (import r7rs) > > (define-library (test) > (import (scheme base)) > (cond-expand > (chicken (begin (define is-chicken? #t))) > (else (begin (define is-chicken #f)))) > (export is-chicken?)) > > csi test2.sld: > > (import (test)) > is-chicken? ; => #t >
Looks like there is an extra pair of parens, I'll check this and get back to you. felix