Zsh Mailing List Archive
Messages sorted by:
Module hierarchies, aliasing, and dependencies
- X-seq: zsh-workers 12784
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: Module hierarchies, aliasing, and dependencies
- Date: Sat, 9 Sep 2000 17:20:16 +0000
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
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
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
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
Messages sorted by: