> (define (f x y)
> (+ 1
> (source-at "foo.scm" 10 2 ;; file line column
> (/ x y))))
This
is a clean approach, however one would have to be careful not to wrap macro symbols this way or else one would cause a "can't
take the value of a macro" error, no?
I considered only applying the macro to lists but unbound variable errors won't report
correct line info in that case. Another option would be to maintain a
list of scheme macro symbols and ensure the clojure-scheme compiler
doesn't attach source info to them. Even though it's now possible to run the compiler on Gambit, I want to maintain the possibility of doing the compilation entirely within the JVM, so I won't have any way to resolve symbols at run-time to see if they are macros.
Perhaps an easier approach
would be to use a reader-macro, so that source info can be applied
before regular macro expansion. Is it possible to tell gsc to use a
custom read table? Or perhaps the ast parser would clobber the line info produced by any reader macros?