hi There is something about macro expansion and csc that i dont understand. I have a macro with-optkeys that calls expand-optkeys to compute a form. I define the macro and the expansion function together in my main file "main.scm" , and then i actually USE the macro to define functions in an api file that gets included, lets call it "myfuncs.scm":

----------------------------------------------
;; main.scm

(define-macro (with-optkeys spec . body)
 (expand-optkeys (car spec) (cdr spec) body))

(define (expand-optkeys args vars body)
  `(let (...) ,@body))

(include "myfuncs.scm")

----------------------------------------------
;; myfuncs.scm

(define (foo . input)
 (with-optkeys (input  (x #t) (y -99) z)
   (list x y z)))
-----------------------------------------------


Now when I try to generate my cpp program it bombs

csc -c++ -embedded -t main.scm


Error: during expansion of (with-optkeys ...) - unbound variable: expand-optkeys



How do i get the (define expand-optkeys ...) to be defined so that my api functions can expand to it when i generate my cpp program?



(if i move the contents of main.scm to the top of myfuncs.scm and then LOAD myfuncse into csi then the api functions defined therein work.)






_______________________________________________
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to