chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] macroexpansion and csc


From: Lui Fungsin
Subject: Re: [Chicken-users] macroexpansion and csc
Date: Fri, 21 Mar 2008 11:19:10 -0700

I guess I hit a related problem.

;; test1.scm
(declare (uses srfi-13))

(eval-when (compile load eval)
  (require-extension srfi-13))

(define-macro (dc stuff)
  (string-downcase stuff))

(print (dc "ABC"))

% csc test1.scm
Error: during expansion of (dc ...) - unbound variable: string-downcase

        Call history:

        <syntax>                (begin (print (dc "ABC")))
        <syntax>                (print (dc "ABC"))
        <syntax>                (dc "ABC")
        <eval>          (string-downcase stuff) <--
*** Shell command terminated with exit status 1:
/usr/local/bin/chicken test1.scm -output-file test1.c -quiet

In this case, I didn't write the srfi-13 module - do I need to modify
srfi-13.scm and recompile chicken?

I guess there should be a way to make string-downcase available in
macro expansion time, right? (I thought the (eval-when (compile load
eval)...) will do the trick)

Thanks

On 3/21/08, John Cowan <address@hidden> wrote:
> Heinrich Taube scripsit:
>
> > (define-macro (with-optkeys spec . body)
> >  (expand-optkeys (car spec) (cdr spec) body))
> >
> > (define (expand-optkeys args vars body)
> >   `(let (...) ,@body))
>
> A procedure (or variable) that is invoked from a low-level macro must
> be defined using define-for-syntax so that it will be available for
> execution at compile time.
>
> --
> Is a chair finely made tragic or comic? Is the          John Cowan
> portrait of Mona Lisa good if I desire to see           address@hidden
> it? Is the bust of Sir Philip Crampton lyrical,         http://ccil.org/~cowan
> epical or dramatic?  If a man hacking in fury
> at a block of wood make there an image of a cow,
> is that image a work of art? If not, why not?               --Stephen Dedalus
>
>
> _______________________________________________
> Chicken-users mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/chicken-users
>




reply via email to

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