Previous: , Up: Eval and Load   [Contents][Index]

4.7.1 Line Numbers

Scheme code defined by load may optionally contain line number information. Currently this information is used only for reporting expansion time errors, but in the future run-time error messages may also include line number information.

Function: try-load pathname reader

This is the primitive for loading, pathname is the name of a file containing Scheme code, and optional argument reader is a function of one argument, a port. reader should read and return Scheme code as list structure. The default value is read, which is used if reader is not supplied or is false.

Line number objects are disjoint from integers or other Scheme types. When evaluated or loaded as Scheme code, an s-expression containing a line-number in the car is equivalent to the cdr of the s-expression. A pair consisting of a line-number in the car and a vector in the cdr is equivalent to the vector. The meaning of s-expressions with line-numbers in other positions is undefined.

Function: read-numbered port

Behaves like read, except that

Function: integer->line-number int

Returns a line-number object with value int. int should be an exact non-negative integer.

Function: line-number->integer linum

Returns the value of line-number object linum as an integer.

Function: line-number? obj

Returns true if and only if obj is a line-number object.

Function: read-for-load port

Behaves like read, except that load syntaxes are enabled.

Variable: *load-reader*
Variable: *slib-load-reader*

The value of *load-reader* should be a value acceptable as the second argument to try-load (note that #f is acceptable). This value will be used to read code during calls to scm:load. The value of *slib-load-reader* will similarly be used during calls to slib:load and require.

In order to disable all line-numbering, it is sufficient to set! *load-reader* and *slib-load-reader* to #f.

Previous: , Up: Eval and Load   [Contents][Index]