From: Andy Wingo <wingo@pobox.com>
To: ludo@gnu.org (Ludovic Courtès)
Cc: Neil Jerram <neil@ossau.uklinux.net>, guile-devel@gnu.org
Subject: Re: Trouble using (current-filename)
Date: Sun, 19 Feb 2012 21:44:59 +0100 [thread overview]
Message-ID: <87liny1rjo.fsf@pobox.com> (raw)
In-Reply-To: <87fwe6ykw2.fsf@gnu.org> ("Ludovic Courtès"'s message of "Sun, 19 Feb 2012 15:10:05 +0100")
Hi,
On Sun 19 Feb 2012 15:10, ludo@gnu.org (Ludovic Courtès) writes:
> Andy Wingo <wingo@pobox.com> skribis:
>
>> On Fri 17 Feb 2012 23:49, ludo@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.
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/
next prev parent reply other threads:[~2012-02-19 20:44 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-14 18:57 Trouble using (current-filename) Mark H Weaver
2012-02-15 22:23 ` Andy Wingo
2012-02-16 21:34 ` Ludovic Courtès
2012-02-16 22:25 ` Andy Wingo
2012-02-17 22:49 ` Ludovic Courtès
2012-02-18 20:58 ` Andy Wingo
2012-02-19 14:10 ` Ludovic Courtès
2012-02-19 20:44 ` Andy Wingo [this message]
2012-02-19 21:02 ` Ludovic Courtès
2012-02-19 21:23 ` Andy Wingo
2012-02-19 21:30 ` Noah Lavine
2012-02-20 13:12 ` Ludovic Courtès
2012-02-21 20:48 ` Neil Jerram
2012-02-21 20:52 ` Ludovic Courtès
2012-02-21 21:00 ` Neil Jerram
2012-03-15 2:00 ` Noah Lavine
2012-03-15 8:34 ` Neil Jerram
2012-03-15 16:41 ` Ludovic Courtès
2012-03-15 21:31 ` Andy Wingo
2012-03-21 21:11 ` Ludovic Courtès
2012-02-21 17:38 ` Mark H Weaver
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87liny1rjo.fsf@pobox.com \
--to=wingo@pobox.com \
--cc=guile-devel@gnu.org \
--cc=ludo@gnu.org \
--cc=neil@ossau.uklinux.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).