Node:Source Properties, Next:Using Traps, Up:Debugging
As Guile reads in Scheme code from file or from standard input, it remembers the file name, line number and column number where each expression begins. These pieces of information are known as the source properties of the expression. If an expression undergoes transformation -- for example, if there is a syntax transformer in effect, or the expression is a macro call -- the source properties are copied from the untransformed to the transformed expression so that, if an error occurs when evaluating the transformed expression, Guile's debugger can point back to the file and location where the expression originated.
The way that source properties are stored means that Guile can only
associate source properties with parenthesized expressions, and not, for
example, with individual symbols, numbers or strings. The difference
can be seen by typing (xxx)
and xxx
at the Guile prompt
(where the variable xxx
has not been defined):
guile> (xxx) standard input:2:1: In expression (xxx): standard input:2:1: Unbound variable: xxx ABORT: (unbound-variable) guile> xxx <unnamed port>: In expression xxx: <unnamed port>: Unbound variable: xxx ABORT: (unbound-variable)
In the latter case, no source properties were stored, so the best that Guile could say regarding the location of the problem was "<unnamed port>".
The recording of source properties is controlled by the read option named "positions" (see Reader options). This option is switched on by default, together with the debug options "debug" and "backtrace" (see Debugger options), when Guile is run interactively; all these options are off by default when Guile runs a script non-interactively.