Hello! Andy Wingo <wi...@pobox.com> skribis:
> On Sun 19 Feb 2012 15:10, l...@gnu.org (Ludovic Courtès) writes: > >> Andy Wingo <wi...@pobox.com> skribis: >> >>> On Fri 17 Feb 2012 23:49, l...@gnu.org (Ludovic Courtès) writes: >>> >>>> Would it work to let the user call it themself if needed, like: >>>> >>>> (add-to-load-path (dirname (canonicalize-path (current-filename)))) >>> >>> I would rather have current-filename do a >>> >>> (or (false-if-exception (canonicalize-path p)) p) >>> >>> Current-filename sounds like it should do the right thing, if possible. >> >> I think it’s often undesirable. >> >> Suppose you want to use ‘current-filename’ in an ‘assert’ macro, for >> instance: what you want is a hint, not an absolute path, since that path >> is likely to be invalid at the time you see it (for instance, it could >> point to the source tree on a build machine of your distro.) >> >> Furthermore, including absolute paths by default makes builds >> non-deterministic: two users would get different binaries, just because >> they built things under a different directory. >> >> Thus, I’d rather let users call ‘canonicalize-path’ when they know what >> they’re doing, and know that they actually need it. >> >> WDYT? > > I'm fine with that, but I think you are concerned more about code in > modules (compiled in one location, installed and run from another) than > for local scripts. Yes. > See Neil's use case here: > > http://thread.gmane.org/gmane.lisp.guile.devel/13440/focus=13621 > > Can we do something that makes sense for both cases? Well, (add-to-load-path (dirname (canonicalize-path (current-filename)))) ? Yes it’s verbose, but it’s predictable and clearly specified. Ludo’.