From: Kevin R. <kp...@ma...> - 2009-10-12 23:18:01
|
On Oct 12, 2009, at 5:43, Leslie P. Polzer wrote: > I know that CLHS recommends this to be the directory in which > the runtime has been started, but the current directory actually > seems much more intuitive in a POSIX environment. > > Has there been a discussion in the past about making sb-posix:chdir > change *default-pathname-defaults*? Would it be desirable to do so? There are several mismatch issues here: 1. CL has dynamic bindings, where the exact previous value is expected to be restored on exit. 2. In POSIX the current directory is not a pathname but (roughly) an open directory, and pathname/directory associations are neither fixed nor one-to-one. 3. *default-pathname-defaults* can be more than just a directory name. (I believe this is rarely used.) It seems to me that the interactions of these two facts are sufficiently hairy that "just" changing both is a bad idea. Two ideas for refinements: 1. Do it as a separate “high level” function (call it, say, sb- ext:change-directory) which both chdirs and assigns *d-p-d*. (Disadvantage: would interact surprisingly with rebinding *d-p-d*.) 2. An *option* which causes all changes of the binding of *d-p-d* (whether assignment, rebinding, or leaving a dynamic scope) to chdir, and possibly vice versa. This might perhaps also eliminate the actual storage of *d-p-d* in favor of "whatever getcwd(3) returns". This mode would not work for POSIX-in-all-its-generality (e.g. unreadable parent directories) but would seamlessly join the intersection of CL and POSIX, which would probably be greatly appreciated by those users which can work within it. -- Kevin Reid <http://switchb.org/kpreid/> |