[plt-scheme] Macro problem: struct name coincides with macro keyword

From: Jens Axel Søgaard (jensaxel at soegaard.net)
Date: Wed May 3 16:46:52 EDT 2006

Ryan Culpepper wrote:
> --- Lauri Alanko <la at iki.fi> wrote:
> 
> 
>>On Wed, May 03, 2006 at 06:36:16PM +0200, Jens Axel Søgaard wrote:
>>
>>>  (require (lib "42.ss" "srfi"))
>>>
>>>  (list-ec (: j (index i)'(a b c))
>>>           (list i j))
>>>  (define-struct index (lexicon positions))
>>
>>>  index: illegal use of syntax in: (index i)

> I agree with both of your points, except in the first solution, the
> srfi should define index as a macro that blows up when used out of
> context:
> 
> (define-syntax index
>   (lambda (stx)
>     (raise-syntax-error #f "used out of context" stx)))

Changing 42.ss did do the trick.

But - suppose I can't change the library in question, what then?

-- 
Jens Axel Søgaard
<http://www.scheme.dk/planet/>




Posted on the users mailing list.