import procedure during macro expansion pasted by alynpost on Sat Dec 28 00:31:46 2013
<++> doit echo csc -s -j m0 -o m0.so m0.scm \ && csc -s -j m0 -o m0.so m0.scm \ && echo csc -s -o m0.import.so m0.import.scm \ && csc -s -o m0.import.so m0.import.scm \ && echo csc -I. -s -j m1 -o m1.so m1.scm \ && csc -I. -s -j m1 -o m1.so m1.scm \ && echo csc -I. -s -o m1.import.so m1.import.scm \ && csc -I. -s -o m1.import.so m1.import.scm \ && echo csc -L. -o main main.scm \ && csc -L. -o main main.scm \ && echo ./main \ && ./main <--> <++> m0.scm (module m0 * (import scheme) (import chicken) (define (f0 x y) `(,x ,y))) <--> <++> m1.scm (module m1 * (import-for-syntax scheme) (import-for-syntax chicken) (import-for-syntax m0) (import scheme) (import chicken) (use m0) (define-syntax make-f1 (ir-macro-transformer (lambda (form rename compare?) (let-values (((a b) (values -1 -2))) `(define (f1 x) (list ,a ,b ,(f0 x (cadr form)))))))) (make-f1 10)) <--> <++> main.scm (use m0 m1) (use extras) (pretty-print (f0 50 100)) (pretty-print (f1 5)) <-->
explicit export, begin-for-syntax pasted by alynpost on Sat Dec 28 00:43:09 2013
<++> doit echo csc -s -j m0 -o m0.so m0.scm \ && csc -s -j m0 -o m0.so m0.scm \ && echo csc -s -o m0.import.so m0.import.scm \ && csc -s -o m0.import.so m0.import.scm \ && echo csc -I. -s -j m1 -o m1.so m1.scm \ && csc -I. -s -j m1 -o m1.so m1.scm \ && echo csc -I. -s -o m1.import.so m1.import.scm \ && csc -I. -s -o m1.import.so m1.import.scm \ && echo csc -L. -o main main.scm \ && csc -L. -o main main.scm \ && echo ./main \ && ./main <--> <++> m0.scm (module m0 (f0) (import scheme) (import chicken) (define (f0 x y) `(,x ,y))) <--> <++> m1.scm (module m1 (make-f1 f1) (import-for-syntax scheme) (import-for-syntax chicken) (begin-for-syntax (use m0)) (import scheme) (import chicken) (use m0) (define-syntax make-f1 (ir-macro-transformer (lambda (form rename compare?) (let-values (((a b) (values -1 -2))) `(define (f1 x) (list ,a x ,(f0 b (cadr form)))))))) (make-f1 10)) <--> <++> main.scm (use m0 m1) (use extras) (pretty-print (f0 50 100)) (pretty-print (f1 5)) <-->
error message from 'sh doit' pasted by alynpost on Sat Dec 28 00:46:08 2013
--(>:)-- sh doit csc -s -j m0 -o m0.so m0.scm csc -s -o m0.import.so m0.import.scm csc -I. -s -j m1 -o m1.so m1.scm Error: during expansion of (make-f1 ...) - unbound variable: f0 Call history: <syntax> (##core#quote f1) <syntax> (##core#quote x) <syntax> (##sys#list (##core#quote list) a (##core#quote x) (f0 b (cadr form))) <syntax> (##core#quote list) <syntax> (##core#quote x) <syntax> (f0 b (cadr form)) <syntax> (cadr form) <eval> (ir-macro-transformer (lambda (form rename compare?) (let-valu es (((a b) (values -1 -2))) (quasiquot...... <syntax> (##core#undefined) <syntax> (make-f1 10) <eval> (##sys#call-with-values (##core#lambda () (values -1 -2)) (##c ore#lambda (a3738 b3940) (##core#let (... <eval> (values -1 -2) <eval> (##sys#list (##core#quote define) (##sys#list (##core#quote f1 ) (##core#quote x)) (##sys#list (##cor...... <eval> (##sys#list (##core#quote f1) (##core#quote x)) <eval> (##sys#list (##core#quote list) a (##core#quote x) (f0 b (cadr form))) <eval> (f0 b (cadr form)) <--
An m1 that works for me added by evhan on Sat Dec 28 00:58:52 2013
(module m1
*
(import scheme)
(import chicken)
(import-for-syntax scheme)
(import-for-syntax chicken)
(begin-for-syntax
(require-library m0))
(import-for-syntax m0)
(define-syntax make-f1
(er-macro-transformer
(lambda (form rename compare?)
(let-values (((a b) (values -1 -2)))
`(define (f1 x)
(list ,a ,b ,(f0 'x (cadr form))))))))
(make-f1 10))