unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Rob Browning <rlb@defaultvalue.org>
Cc: guile-devel <guile-devel@gnu.org>
Subject: Re: The load path
Date: Fri, 05 Nov 2004 12:59:02 -0600	[thread overview]
Message-ID: <87actw15s9.fsf@trouble.defaultvalue.org> (raw)
In-Reply-To: <m37jp0yyvy.fsf@multivac.cwru.edu> (Paul Jarc's message of "Fri, 05 Nov 2004 12:43:39 -0500")

prj@po.cwru.edu (Paul Jarc) writes:

> I'm thinking of the case where a user wants to avoid something the
> admin put in the init code, or insert some other code ahead of it.
> The user can't touch the sitewide init directory, so it can only be
> controlled on the command line.

Ahh, so you don't mean the case where the user installed their own
copy of guile.  Ok, then for that, --disable-init-d might be good,
though "--init-dir /dev/null" might work too ;>

Having both options might make sense, i.e. --disable-init-dir and
"--init-dir DIR".

>> That might argue for a use-modules or require/provide style solution,
>> though if appropriate, we'd want a modified one that only looks in the
>> init.d dir so that startup files can't be confused with files in other
>> packages (i.e. don't use load-path).
>
> Maybe best practice would be to put the initialization code in a
> normal module called (foo init), and then the init file merely loads
> that module.

Hmm, but that won't allow the init file to set up the %load-path if
needed, i.e.

  init.d/package-a.scm: (use-modules (b init))

  init.d/package-b.scm: (set! %load-path (cons ... %load-path)) ...

So package-a's init will fail if it is run first.

I also think we may need at least enough documented convention that
the local admin can easily have a place to put their customizations,
and can have sufficient control over when they are run.

An alternate specification would be to require the init files to be
modules named (init.d foo), and just arrange for
${siteconfdir}/guile-X.Y/ to be first in the %load-path before guile
starts processing.  So package foo would install
guile-X.Y/init.d/foo.scm.

However I'm still a little unsure about crowding the init process
directly into the module namespace.  Perhaps that's the right thing,
but I'm not convinced yet.  It would mean that we'd have to reserve a
namespace like (init.d ...)  and it would mean that all of the (init.d
foo) modules would be visible to normal, non-init code, and there's no
reason for that.

It also still doesn't leave any way for the local admin to specify
configurations that are guaranteed to run at a particular time without
modifying all the other init files.

Here's a possible alternative:

  - specify ${siteconfdir}/guile-X.Y/init.d/ for "add-ons".

  - add a new bit of infrastructure.  A trivial guile module called
    something like (guile init) which provides:

      (guile-run-initialization . dir) ;; load INITDIR/* in order.
      (guile-init-require name) ;; load INITDIR/name.scm iff not loaded
      (guile-init-provide name) ;; called by INITDIR/name.scm on success

  - have guile look for ${siteconfdir}/guile-X.Y/init.scm at startup.
    If that isn't found, then have it run (guile-run-initialization
    "${siteconfdir}/guile-X.Y/init.d").

    However, if ${siteconfdir}/guile-X.Y/init.scm is found, guile just
    runs that.  So if the local admin creates an init.scm, then they
    need to add this to the file

      (use-modules (guile init))
      (guile-run-initialization "${siteconfdir}/guile-X.Y/init.d")

    if they want the normal startup behavior.  We'll also provide a
    skeleton init.scm to demonstrate this in our documentation.

  - add "--confdir DIR" and --disable-init command line options.

This approach would allow dependencies without conflating
initialization and the normal module namespace, and it seems like it
would allow the local admin a reasonable level of control.

-- 
Rob Browning
rlb @defaultvalue.org and @debian.org; previously @cs.utexas.edu
GPG starting 2002-11-03 = 14DD 432F AE39 534D B592  F9A0 25C8 D377 8C7E 73A4


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


  reply	other threads:[~2004-11-05 18:59 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-16 17:52 The load path Andy Wingo
2004-10-17 19:40 ` Rob Browning
2004-10-17 23:13 ` Greg Troxel
2004-11-05 15:05 ` Marius Vollmer
2004-11-05 15:25   ` Paul Jarc
2004-11-05 16:43     ` Rob Browning
2004-11-05 17:43       ` Paul Jarc
2004-11-05 18:59         ` Rob Browning [this message]
2004-11-05 19:22           ` Paul Jarc
2004-11-05 22:05             ` Rob Browning
2004-11-06  7:25               ` Paul Jarc
2004-11-06 16:19                 ` Rob Browning
2004-11-06 22:58                   ` Rob Browning
2004-11-05 16:15   ` Rob Browning
2004-11-05 17:31   ` Andreas Rottmann
2004-11-05 18:57     ` Greg Troxel
2004-11-05 19:07     ` Rob Browning
2004-11-05 19:19   ` Greg Troxel
2004-11-05 23:53     ` Neil Jerram
2004-11-06  4:54       ` Rob Browning
2004-11-06 14:38         ` Andreas Vögele
2004-11-06 17:49         ` Neil Jerram
2004-11-06 21:21           ` Rob Browning
2004-11-07 18:46             ` Neil Jerram
2004-11-07 21:16               ` Rob Browning
2004-11-09 15:22               ` Paul Jarc
2004-11-10 18:43           ` Andy Wingo
2004-11-11 13:23             ` Greg Troxel
2004-11-12 21:31             ` Neil Jerram
2004-11-13  0:22               ` Greg Troxel
2004-11-13  1:08                 ` Rob Browning
2004-11-13 16:12                   ` Greg Troxel
2004-11-14 11:02                     ` Neil Jerram
2004-11-14 14:05                       ` Greg Troxel
2004-11-18 19:44                         ` Neil Jerram
2004-11-19 14:46                           ` Greg Troxel
2004-11-14 10:48                   ` Neil Jerram
2004-11-15 16:43                     ` Andy Wingo
2004-11-18 19:54                       ` 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=87actw15s9.fsf@trouble.defaultvalue.org \
    --to=rlb@defaultvalue.org \
    --cc=guile-devel@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).