[Top][All Lists]

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

Re: [Chicken-users] Macros not found when using eval

From: Evan Hanson
Subject: Re: [Chicken-users] Macros not found when using eval
Date: Mon, 14 Aug 2017 19:34:55 +1200

Hi mel,

You can use the "-compile-syntax" flag with csc(1), which will include
the macro definition in the compiled code and thus make it available at
runtime. Let us know how that works out.

As for your second question, it's tough to say much without an example,
but I'm guessing you're looking at a situation like this:

   ;; foo.scm
   (module foo (kons)
     (import scheme)
     (define (kons a b)
       (cons a b)))

   ;; bar.scm
   (use foo)
   (display (eval '(kons 1 '(2 3))))  ; <--- Error: unbound variable: kons

To which the solution is:

   ;; bar.scm
   (eval '(use foo))
   (display (eval '(kons 1 '(2 3))))

This imports the module at runtime and makes it available in `eval`.

Of course if I've guessed your problem incorrectly just let us know and
we'd be happy to help with anything else.



On 2017-08-13 17:32, mel aise wrote:
I'm having some trouble with the following program:

(define-syntax kons
 (syntax-rules ()
   ((_ a b)
     (cons a b))))

(display (kons 1 '(2 3)))
(display (eval '(kons 1 '(2 3))))

(It's a contrived example but gets to whats going on haha)
When run with csi everything works fine,
but when compiled and then run, 'eval' throws an unbound variable error

I may be missing something but is there a way to let 'eval' find syntax
that has been defined?
I'm also having a similar issue with 'use'ing a module and 'eval' not being
able to find procedures defined in that module

Chicken-users mailing list

reply via email to

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