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

Re: program-vicinity



 | Date: Sun, 09 Jan 2005 22:18:40 -1000 (HST)
 | From: Shiro Kawai <shiro@xxxxxxxx>
 | 
 | The return value of program-vicinity is currently undefined when
 | there's no file being loaded.  Is there any reason for that?

Which directory should be the value of program-vicinity be when no
file is being loaded?  If it is the directory containing the file
containing the call to program-vicinity, then every procedure which
contains a call to program-vicinity must carry a source-file
annotation.

Which directory should it be when the call to program-vicinity was
introduced by a macro?

Which directory should it be when called by a procedure defined using
eval or pasted into an interactive top-level?

 | Without a portable means of knowing if the file is being loaded or
 | not,

But there is a portable way: redefine LOAD to fluid-let a variable
(say *load-pathname*) or program-vicinity to return the vicinity
during its dynamic extent.  This was missing from reference
implementation; I will add it.

 | there's no way to guarantee a piece of Scheme code that's using
 | program-vicinity work (e.g. if the file is piped from stdin).  If
 | it returns #f, for example, then such a code can signal an error or
 | use some fallback value.
 | 
 | (Another possibility is to allow an optional argument for
 | program-vicinity that is used as the fallback value.  However, it
 | might interfere with the implementation that might want to use
 | srfi-39 parameter to implement program-vicinity).