[gambit-list] Compiling "post-reader" forms?

Marc Feeley feeley at iro.umontreal.ca
Sun Jun 2 02:23:41 EDT 2013

On Jun 1, 2013, at 10:54 PM, Nathan Sorenson <takeoutweight at hotmail.com> wrote:

> > (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 don't think so because the interpreter and compiler unwrap symbols when checking if they refer to macros.  Do you have an example where this is not happening?

> I considered only applying the macro to lists but unbound variable errors won't report correct line info in that case.

That is a bug in the interpreter that was introduced not too long ago (just type an undefined variable at the REPL and the error will be reported without location information).  It is now fixed in the Gambit repo.

>  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?

I think this is not relevant.  Can you double check?


More information about the Gambit-list mailing list