[racket] Metaprogramming with scheme
On 21.06.2010 18:25, Noel Welsh wrote:
> 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.
>
>
Yes that helps
>> 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.
>
>
That the problem. The location will be location inside foo but not
location where foo was called from