unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Andy Wingo <wingo@pobox.com>
Cc: Neil Jerram <neil@ossau.uklinux.net>, guile-devel@gnu.org
Subject: Re: Trouble using (current-filename)
Date: Sun, 19 Feb 2012 22:02:40 +0100	[thread overview]
Message-ID: <87linywn7z.fsf@gnu.org> (raw)
In-Reply-To: <87liny1rjo.fsf@pobox.com> (Andy Wingo's message of "Sun, 19 Feb 2012 21:44:59 +0100")

Hello!

Andy Wingo <wingo@pobox.com> skribis:

> 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.

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’.



  reply	other threads:[~2012-02-19 21:02 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
2012-02-19 21:02               ` Ludovic Courtès [this message]
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=87linywn7z.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=guile-devel@gnu.org \
    --cc=neil@ossau.uklinux.net \
    --cc=wingo@pobox.com \
    /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).