[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Trouble using (current-filename)
From: |
Andy Wingo |
Subject: |
Re: Trouble using (current-filename) |
Date: |
Sun, 19 Feb 2012 21:44:59 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) |
Hi,
On Sun 19 Feb 2012 15:10, address@hidden (Ludovic Courtès) writes:
> Andy Wingo <address@hidden> skribis:
>
>> On Fri 17 Feb 2012 23:49, address@hidden (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.
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? For example, we
might canonicalize-path only if we don't find the filename within the
current load path.
Andy
--
http://wingolog.org/
- Trouble using (current-filename), Mark H Weaver, 2012/02/14
- Re: Trouble using (current-filename), Andy Wingo, 2012/02/15
- Re: Trouble using (current-filename), Ludovic Courtès, 2012/02/16
- Re: Trouble using (current-filename), Andy Wingo, 2012/02/16
- Re: Trouble using (current-filename), Ludovic Courtès, 2012/02/17
- Re: Trouble using (current-filename), Andy Wingo, 2012/02/18
- Re: Trouble using (current-filename), Ludovic Courtès, 2012/02/19
- Re: Trouble using (current-filename),
Andy Wingo <=
- Re: Trouble using (current-filename), Ludovic Courtès, 2012/02/19
- Re: Trouble using (current-filename), Andy Wingo, 2012/02/19
- Re: Trouble using (current-filename), Noah Lavine, 2012/02/19
- Re: Trouble using (current-filename), Ludovic Courtès, 2012/02/20
- Re: Trouble using (current-filename), Neil Jerram, 2012/02/21
- Re: Trouble using (current-filename), Ludovic Courtès, 2012/02/21
- Re: Trouble using (current-filename), Neil Jerram, 2012/02/21
Re: Trouble using (current-filename), Mark H Weaver, 2012/02/21