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

Re: "source"-vicinity

This page is part of the web mail archives of SRFI 59 from before July 7th, 2015. The new archives for SRFI 59 contain all messages, not just those from before July 7th, 2015.



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
instance.

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.

Consider:
f.scm:
(define (f) (source-vicinity))

g.scm:
(define v (f))

Top-level:
(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
them.
--
	--Per Bothner
per@xxxxxxxxxxx   http://per.bothner.com/