From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14672 invoked from network); 9 Sep 2000 17:21:23 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 9 Sep 2000 17:21:23 -0000 Received: (qmail 11639 invoked by alias); 9 Sep 2000 17:21:13 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 12784 Received: (qmail 11629 invoked from network); 9 Sep 2000 17:20:56 -0000 From: "Bart Schaefer" Message-Id: <1000909172016.ZM3792@candle.brasslantern.com> Date: Sat, 9 Sep 2000 17:20:16 +0000 X-Mailer: Z-Mail (5.0.0 30July97) To: zsh-workers@sunsite.auc.dk Subject: Module hierarchies, aliasing, and dependencies MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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