[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "source"-vicinity

Program-vicinity is typically used to load pieces of programs at what
in Common-Lisp is called compile-time.  But program-vicinity is also
used at run-time for locating the software license or help text, for

That's not what srfi-59.html says:
  For a compiled system (with multiple files) this would be the
  directory where the object or executable files are.

We would like to be able to call
program-vicinity at any point in the code and have it return the same
value as a top-level-captured vicinity.  But to have it evaluated
during the load would require it be a read-syntax, wouldn't it?

It can be regular syntax *iff* the Scheme reader annotates the
resulting forms with line-number information, in some way or other.
Some Schemes do - at least Chez Scheme, PLT Scheme, and Kawa.
Any Scheme that can provide error diagnostics with a line-number
needs some way of doing this.

Must source-vicinity be distinct from program-vcinity?

Perhaps not, depending on how it is defined.

(define (f) (source-vicinity))

(define v (f))

(load "f.scm")
(load "g.scm")

What is the value of v?  It should return "f.scm".
I do believe this is useful, for diagnostics.

If you replace source-vicinity by program-vicinity, and the
latter is defined as "Returns the vicinity of the currently
loading Scheme code" then the result would be "g.scm".
Is that useful?  I don't know.

If only one of these results is useful, then you can combine
	--Per Bothner
per@xxxxxxxxxxx   http://per.bothner.com/