unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: ludovic.courtes@laas.fr (Ludovic Courtès)
Cc: guile-user@gnu.org
Subject: Re: Modified load-path proposal
Date: Fri, 16 Dec 2005 10:55:49 +0100	[thread overview]
Message-ID: <87hd99z7q2.fsf@laas.fr> (raw)
In-Reply-To: <87r78duc9d.fsf@ossau.uklinux.net> (Neil Jerram's message of "Fri, 16 Dec 2005 00:16:46 +0000")

Neil Jerram <neil@ossau.uklinux.net> writes:

> How so?  Given that you're about to do a (use-modules (whatnot)), I
> can't see that also doing (initialize-packages "whatnot") will make a
> significant difference.

Because people haven't been doing so for years.  Some of us certainly
don't want to iterate over each and every Guile module to add this line.
It's quite a big change and it's very interpreter-centric (okay, this
last point is maybe not the strongest argument I could come up with
;-)).

It would be different if the `initialize-packages' line could be added
automatically --- in fact, `use-modules' could do it and this would be
completely transparent to the module user (more below).

Furthermore, other interpreters are less intrusive in that respect
AFAIK.

>From a performance viewpoint, you still end up reading _and evaluating_
one more file, thus increasing actual start-up time (because chances are
that 90% of the modules that will ever be loaded by a program are loaded
at start-up time).

> I proposed something very like this before:
> http://lists.gnu.org/archive/html/guile-user/2005-10/msg00098.html
> But then I changed my mind, for reasons given here:
> http://lists.gnu.org/archive/html/guile-user/2005-10/msg00109.html

I suspected this to have already been said.  Sorry for not looking it up
in the archive.

> Sure, but simple is a complicated concept :-).  For example, the
> initialize-packages approach is simple in that it doesn't require a
> post-install script to work (whereas the config.scm approach does).

Right.  But, well, as long as this is encapsulated in some Automake
machinery, it doesn't make a big difference.

> Things aren't clear cut in terms of cycles either.  Suppose you have
> 20 Guile packages installed on your computer, spread across 6
> different load path locations.  With the config.scm approach you will
> always have all 6 locations in your load path, even when running a
> script that uses only one package (or no packages at all), so on
> average it will take a little longer to load every file that the
> script needs.  With the initialize-packages approach, the script's
> load path will only contain the directories that it really needs.

Right.

But then, an intermediate approach could consist in having an `init.d'
directories where files cannot contain arbitrary code, i.e., they only
contain a string (the load path).

Additionally, I'd be quite happy if the `initialize-packages' phase
could be made automatic.  This could be done like this:

  1. Packages install their module hierarchy wherever they want;

  2. In addition, packages may install a start-up file in, say,
     /usr/share/guile/packages/ (installing these files into the right
     Guile directory could be done by a wrapper script, say
     `guile-install-module-init').

     For instance, if I am to install the complete `foo' module
     hierarchy, then I can install /usr/share/guile/packages/foo.init
     that will be read, if available, the first time a `(foo SOMETHING)'
     module is loaded.  If that file was available, its content (a
     string) are added to `%load-path'.


More generally, when module `(foo bar)' is loaded for the first time,
Guile could:

1. Look for /../packages/foo/bar.init and use its content to
   augment `%load-path' if available;

2. If the previous file wasn't available, look for
   /../packages/foo.init and use its content to augment
   `%load-path' if available;

3. If no `init' file was found, just leave `%load-path' unchanged.


This way, `init' files are loaded on demand, like in your
`initialize-packages' approach.  However, it is less intrusive.

This is based on the observation that (i) we want modules to be
installable in *any* directory, but (ii) at some point, there must be a
*fixed* directory to look for files to bootstrap further file loading.

Not being able to execute arbitrary code in an init file is not a
problem: anyway, once an init file has been loaded, the module itself
can be loaded and execute whatever code it wants.

Note that I'm not addressing shared library load paths at all here.
However, such a mechanism could certainly be extended to support it.

Thanks,
Ludovic.


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


  parent reply	other threads:[~2005-12-16  9:55 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-13 18:21 Modified load-path proposal Neil Jerram
2005-10-13 18:40 ` Greg Troxel
2005-10-13 22:08   ` Neil Jerram
2005-10-14  0:37     ` Greg Troxel
2005-10-14  1:28       ` Andreas Rottmann
2005-10-15 11:17         ` Neil Jerram
2005-10-15 15:03           ` Greg Troxel
2005-10-15 17:53             ` Neil Jerram
2005-10-22 23:16           ` Kevin Ryde
2005-10-28 17:45             ` Neil Jerram
2005-10-30 18:04               ` Neil Jerram
2005-10-30 18:15                 ` Tomas Zerolo
2005-10-30 20:37                 ` Thien-Thi Nguyen
2005-10-30 22:59                   ` Neil Jerram
2005-10-31 10:55                     ` Thien-Thi Nguyen
2005-10-31 19:22                       ` Neil Jerram
2005-11-08 12:37                         ` Thien-Thi Nguyen
2005-10-31 13:17                   ` Tomas Zerolo
2005-10-30 23:48                 ` Kevin Ryde
2005-10-31 13:20                   ` Tomas Zerolo
2005-10-31 19:20                   ` Neil Jerram
2005-10-31 23:54                     ` Kevin Ryde
2005-11-12  9:47                       ` Neil Jerram
2005-11-01 23:31                     ` Vorfeed Canal
2005-11-12 17:54                       ` Neil Jerram
2005-11-02  8:44                 ` Ludovic Courtès
2005-12-03 13:05                   ` Neil Jerram
2005-12-13  8:38                     ` Ludovic Courtès
2005-12-16  0:16                       ` Neil Jerram
2005-12-16  1:00                         ` Neil Jerram
2005-12-16  9:55                         ` Ludovic Courtès [this message]
2006-01-07 13:37                           ` Neil Jerram
2006-01-11  4:49                             ` steve tell
2006-01-12 18:01                               ` Neil Jerram
2005-10-15 11:24       ` Neil Jerram
2005-10-15 15:01         ` Greg Troxel
2005-10-15 17:49           ` Neil Jerram
2005-10-14  7:24 ` Ludovic Courtès
2005-10-15 11:55   ` Neil Jerram
2005-10-15 15:40     ` Greg Troxel
2005-10-17  8:04       ` Ludovic Courtès
2005-10-17 17:52         ` Greg Troxel
2005-10-18  8:23           ` Search path for C libraries Ludovic Courtès
2005-10-18 10:12             ` Vorfeed Canal
2005-10-17 17:54         ` Modified load-path proposal Neil Jerram
2005-10-18  7:57           ` Ludovic Courtès
2005-10-19 22:30             ` Neil Jerram
2005-10-20  7:56               ` Vorfeed Canal
2005-10-20  8:05               ` Ludovic Courtès
2005-10-20 22:23                 ` Neil Jerram
2005-10-21  7:59                   ` Ludovic Courtès
2005-10-17 18:10       ` Neil Jerram
2005-10-18 16:16         ` Greg Troxel
2005-10-18 21:24           ` Vorfeed Canal
2005-10-19 22:29           ` Neil Jerram

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=87hd99z7q2.fsf@laas.fr \
    --to=ludovic.courtes@laas.fr \
    --cc=guile-user@gnu.org \
    /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).