[racket] Metaprogramming with scheme
On Mon, Jun 21, 2010 at 2:41 PM, Valeriya Pudova
<valery at digitalchile.net> wrote:
> There are two issues.
>
> First:
>
> what if the file foo.ss will have defined function foo.
>
> (define (foo a b) (+ a b)))
> (foo 1 2)
>
> It makes error:
> Got compile: unbound identifier (and no #%app syntax transformer is bound)
> (#(struct:exn:fail:syntax compile: unbound identifier (and no #%app syntax
> transformer is bound) #<continuation-mark-set>
This is a namespace issue. You need to create a namespace (with, e.g.,
(make-base-namespace)) and pass that as the 2nd optional argument to
eval-syntax. See the Guide and Reference for more detail.
> Second:
> When function foo is defined correctly and called from the eval process and
> errors occurs in foo, how can we find the caller's location in order to
> format an error message?
I think whatever location information is available will be in the exception.
N.