[plt-scheme] Can't see the tree for the forest

From: Jens Axel Søgaard (jensaxel at soegaard.net)
Date: Sun Jul 8 17:56:40 EDT 2007

Matthew Flatt wrote:
> At Sun, 08 Jul 2007 22:16:31 +0200, Jens Axel Søgaard wrote:
>> In the goto macro (which expands (goto name) into (name), when
>> the name is known label, I want to check whether the
>> name is known or not. For some reason that escapes me,
>> the test
>>    (srfi:member #'name (syntax->list #'(name1 ...)) module-identifier=?)
>> fails for both known and unknown label names.
>>
>> In the attached file, the test has been replaced with #t in order
>> to test the rest.
>>
>> What am I missing?
> 
> The `goto' local macro is outside the binding of the target labels. So
> the `name' has been bound at the point of the text, but the `name1's
> haven't.
> 
> I think you need to bind the `goto' macro and the labels all together:
> 
>   (letrec-syntaxes+values ([(goto) ...])
>                           ([(label-name)      (lambda () expr ... continue)]
>                            ...
>                            [(end-label-name)  (lambda () end-expr ...)])
>     (start))

That was it. Thanks!

/Jens Axel



Posted on the users mailing list.