[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Scheme-reports] [wg2] in support of single-arity procedural syntax transformers
On Thu 12 May 2011 11:27, Alaric Snell-Pym <alaric@x> writes:
> I think Andy's opined in the past that using weak maps to [map source
> information to code] is insufficient, requiring explicit syntax
> objects rather than just sexprs.
> Andy, is that a correct interpretation, and if so, can you explain that?
Yes, I've said that, though it does seem a minor point. (A herring-tail
wagging a dog?) Basically the deal is that in an expression like:
0: (+ 37
where `bar' is unbound, you want to say "line 2 column 4: `bar' is
unbound", rather than attributing the error to (say) line 0. I keep
using Racket as the example here, because I think they do it very well,
even highlighting the expression precisely in their editor.
But this sort of information is difficult to propagate through an
expander if you don't wrap your s-expressions in some other data
structure, like a syntax object.
What Guile does, and AFAIK what Chicken does as well, is to have `read'
build up a weak map of heap-thing to source-information. But you can't
get source info for bare symbols with such an interface. I get bugs
about that sometimes:
Now, to actually get such source information in the first place, you
need a `read-syntax':
But that need not be specified.
Scheme-reports mailing list