chicken-users
[Top][All Lists]
Advanced

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

[Chicken-users] macroexpansion and csc


From: Heinrich Taube
Subject: [Chicken-users] macroexpansion and csc
Date: Fri, 21 Mar 2008 10:33:14 -0500

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.)








reply via email to

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