[plt-scheme] Changing source location information

From: Jens Axel Søgaard (jensaxel at soegaard.net)
Date: Tue Aug 4 10:35:07 EDT 2009

Hi Eli,

2009/8/4 Eli Barzilay <eli at barzilay.org>:
> On Aug  4, Jens Axel Søgaard wrote:
>> Hi All,
>> I want to use the at-exp syntax for a little macro.  My problem is
>> how to produce the correct source location when reading from the
>> string.
>> A simple version of the problem can be seen in the macro foo below.
> I'm not sure what is exactly the problem with at-exp --

>I see both uses suffering from the same problem.

There is not a problem with at-exp. I wrote both versions to
make sure the at-exp syntax wasn't causing the problem.

> In any case, I think that
> you're missing a third #'str in
>  (datum->syntax #'str (syntax->datum result) #'str)
>                                              ^^^^^
>                                              here

Ideally I'd like to write simply use result as-is.

> (But I'm not sure I'm following the code, looks like the
> `syntax->datum' is a temporary hack to figure out what's wrong?)


> To make it work better, you'll want to scan the resulting syntax, and
> adjust source information from the string to correspond to the
> location in the real source.

That's exactly what I was hoping to avoid,

I am now experimeting a little with relocate-input-port.

Jens Axel Søgaard

Posted on the users mailing list.