unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Andy Wingo <wingo@pobox.com>
To: Neil Jerram <neil@ossau.uklinux.net>
Cc: guile-user@gnu.org
Subject: Re: Modules
Date: Sun, 13 Feb 2011 20:05:16 +0100	[thread overview]
Message-ID: <m3hbc792mr.fsf@unquote.localdomain> (raw)
In-Reply-To: <m3pqre39f4.fsf@unquote.localdomain> (Andy Wingo's message of "Sun, 30 Jan 2011 12:42:07 +0100")

Hello list,

A couple weeks ago I wrote about figuring out relative paths for `load'
in 1.9:

On Sun 30 Jan 2011 12:42, Andy Wingo <wingo@pobox.com> writes:

> it's not clear what to do, exactly, when
> you have compiled files; you could not have the corresponding .scm at
> all, or in any case when you've loaded the .go you don't actually have a
> port to the .scm, and in fact if the file was loaded via
> `load-from-path' you don't know exactly where the .scm is at all.
>
> Perhaps we should residualize into the .go whether the file was compiled
> for `load' or for `load-from-path', and what was the original path of
> the file.

It turns out we already have this information on the Scheme level, in
the form of source properties of the expressions.  Macros have access to
this via `syntax-source'.  Also, with "relative" filename
canonicalization, the `filename' property of a syntax source will be a
relative path if it was found in the load path, and an absolute path
otherwise.

So, I ended up reimplementing `load' as a macro (!) that expands out to
a call to `load-in-vicinity'.  Relative paths are looked up against the
dirname of the file being expanded.  If the dirname is relative, then
load-from-path is used, and otherwise load is used.

A bare reference to `load' returns a closure that will invoke
`load-in-vicinity' with an appropriate vicinity.

Hopefully this fully fixes bug 30480, discussed in
http://thread.gmane.org/gmane.lisp.guile.bugs/4359, and *part* of this
use case.  We still need an (add-to-load-path "."), as discussed in a
previous mail, to allow use-modules for uninstalled modules to work
reliably.

Cheers,

Andy
-- 
http://wingolog.org/



  reply	other threads:[~2011-02-13 19:05 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-08 11:45 Modules Marek Kubica
2010-12-08 18:11 ` Modules Andreas Rottmann
2010-12-09  1:19 ` Modules Nala Ginrut
2011-01-28 16:26 ` Modules Andy Wingo
2011-01-29 12:13   ` Modules Marek Kubica
2011-01-29 13:08     ` Modules Neil Jerram
2011-01-29 13:18       ` Modules Neil Jerram
2011-01-29 17:04     ` Modules Andy Wingo
2011-01-29 18:37       ` Modules Marek Kubica
2011-01-29 23:17       ` Modules Neil Jerram
2011-01-30 10:13         ` Modules Thien-Thi Nguyen
2011-01-30 11:42         ` Modules Andy Wingo
2011-02-13 19:05           ` Andy Wingo [this message]
2011-01-29 17:07     ` Modules Andy Wingo
2011-01-29 18:40       ` Modules Marek Kubica
2011-01-29 23:35       ` Modules Neil Jerram
2011-02-01 21:43         ` Modules Andy Wingo
2011-02-02 14:43         ` Modules Jon Wilson
  -- strict thread matches above, loose matches on Subject: below --
2004-03-21  5:40 modules Ian Zimmerman
2004-03-21 14:47 ` modules Andreas Rottmann
2004-03-22 18:05   ` modules Ian Zimmerman
2004-03-23 16:05     ` modules Robert Uhl
2004-03-21 21:29 ` modules Thien-Thi Nguyen

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=m3hbc792mr.fsf@unquote.localdomain \
    --to=wingo@pobox.com \
    --cc=guile-user@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).