From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6977 invoked from network); 11 Dec 1998 14:21:35 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 11 Dec 1998 14:21:35 -0000 Received: (from list@localhost) by math.gatech.edu (8.9.1/8.9.1) id JAA09852; Fri, 11 Dec 1998 09:18:33 -0500 (EST) Resent-Date: Fri, 11 Dec 1998 09:18:33 -0500 (EST) Date: Fri, 11 Dec 1998 15:16:46 +0100 (MET) Message-Id: <199812111416.PAA03428@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@math.gatech.edu In-reply-to: "Bart Schaefer"'s message of Fri, 11 Dec 1998 05:18:22 -0800 Subject: Re: wrapper functions in modules Resent-Message-ID: <"pb23Z2.0.tP2.vcISs"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/4753 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu Bart Schaefer wrote: > ... [ several serious problems with the wrapper functions ] I stand corrected. And damn, my first idea was to let modules register only one function which would have to call back the execution code, i.e.: doshfunc(...) { ... runshfunc(list, wrappers); ... } runshfunc(List list, FuncWrap wrap) { if (wrap) wrap->func(list, wrap->next); else { ... execlist(...); ... } } example_wrapper(List list, FuncWrap wrap) // from module { ... do something runshfunc(list, wrap); ... restore something } This would solve the call stack problems you mentioned. Also, writing wrappers would be easier in modules since you can use local variables, static local variables for number-of-calls and so on... About the problems with unloading: I would vote for completely disallowing to unload a module if a wrapper is active for it. This is relatively easy to keep track of and seems to be the savest, the question is: how often does one want to unload modules in shell functions? Finally about the order in which installed wrappers are to be called: looking at load_module() it should be enough to build the wrappers list by appending new definitions to the end. Ok. No patch for now, just the question: does this sound ok? And, of course, if someone has ideas for a completely different solution, I would like to hear about it. Bye Sven -- Sven Wischnowsky wischnow@informatik.hu-berlin.de