On May 31, 2013, at 9:28 AM, Nathan Sorenson <takeoutweight@hotmail.com> wrote:

When translating Clojure code to Scheme, I'm finding it quite easy to preserve source code information for the Gambit interpreter, so that when I get exceptions I am notified of the offending Clojure source lines. Is there an obvious way I could do this for compiled code as well?

There isn't a form for this, but that would be useful and I have thought about adding it.  Something like a "source-at" special form.

For example,

   (source-at "foo.scm" 10 2 ;; file line column
              ((source-at "foo.scm" 10 8 cons)
               (source-at "foo.scm" 10 8 x)
               (source-at "foo.scm" 10 10 y)))

would be equivalent to

   (cons x y)

but with explicit source location information.

Actually this source-at form can be easily defined as a macro give me a few minutes.

Marc