zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: zsh-workers@sunsite.auc.dk
Subject: Module hierarchies, aliasing, and dependencies
Date: Sat, 9 Sep 2000 17:20:16 +0000	[thread overview]
Message-ID: <1000909172016.ZM3792@candle.brasslantern.com> (raw)

At present, the name used to load a module is the only indication zsh has
of whether a particular module is has been loaded.  This is used both by
the dependency system and by the zmodload command.  So for example if one
does

	module_path=($module_path $^module_path/zsh)
	zmodload zleparameter

one has now loaded zsh/zleparameter, but zsh doesn't know it; and loading
it again as zsh/zleparameter fails (because the widgets variable is read-
only).  Even modules that can be successfully loaded more than once give
lots of error messages like:

zsh/zle: name clash when adding hook `list_matches'
zsh/zle: name clash when adding hook `complete'
zsh/zle: name clash when adding hook `before_complete'
zsh/zle: name clash when adding hook `after_complete'
zsh/zle: name clash when adding hook `accept_completion'
zsh/zle: name clash when adding hook `reverse_menu'
zsh/zle: name clash when adding hook `invalidate_list'

Of course this can be written off as misuse of zmodload and $module_path.
However, suppose I have my own locally-hacked version of the "files"
module (adds chmod and mkfifo, or some such).  I'd like to make both
this module and the distributed zsh/files module available for loading.
If I put it in the default module path, under a different hierarchy --
say, /usr/local/lib/zsh/3.1.9/local/files -- then it can be loaded with
"zmodload local/files", but it won't satisy dependencies on "zsh/files".
I could put my local one in a completely different directory in the
module_path -- /usr/local/lib/zsh/local, or something -- still under the
name zsh/files, so that it satisfies the dependencies; but then there's
no way to load some local modules and other standard modules without
changing the value of $module_path before every zmodload.

Wouldn't it be better to rely on a symbol that's defined *inside* the
module to determine whether a module has been loaded?  Similar to the way
(provides 'name) works in emacs libraries?

One way to approach this would be to add another function, like the boot
and cleanup functions that already exist, which is called when searching
the list of modules.  We could define this function to return a string
that is compared to the module being searched for; or we could pass the
string being searched for into the function and let it return a truth
value.  If the function isn't defined by a given module, then compare the
name strings as is done now.

Does anyone foresee any serious problems with such an approach?  Is there
a better way?  Is there disagreement over whether this is worth doing?

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


             reply	other threads:[~2000-09-09 17:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-09-09 17:20 Bart Schaefer [this message]
2000-09-10 21:16 ` Peter Stephenson
2000-09-10 21:35   ` Zefram
2000-09-10 22:29     ` Bart Schaefer
2000-09-14 15:18       ` Andrej Borsenkow
2000-09-14 16:36         ` Bart Schaefer
2000-09-14 17:15           ` Andrej Borsenkow
2000-09-15 18:14           ` Andrej Borsenkow

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1000909172016.ZM3792@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=zsh-workers@sunsite.auc.dk \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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 NNTP newsgroup(s).