Zsh Mailing List Archive
Messages sorted by:
Re: wrapper functions in modules
- X-seq: zsh-workers 4755
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxx>
- To: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>, zsh-workers@xxxxxxxxxxxxxxx
- Subject: Re: wrapper functions in modules
- Date: Fri, 11 Dec 1998 09:40:53 -0800
- In-reply-to: <199812111416.PAA03428@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- References: <199812111416.PAA03428@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
On Dec 11, 3:16pm, Sven Wischnowsky wrote:
} Subject: Re: wrapper functions in modules
} [...] my first idea was to let modules register only one function
} which would have to call back the execution code [...]
} 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...
This would indeed be an improvement. An interesting side-effect is that
it would permit a module to decide not to run the shell function at all;
it could instead branch off into any code it liked.
That in turn probably makes modules even more dangerous than before, from
a run-time perspective. An innoccuous module placed in root's module path
could suddenly have someone else driving the shell. It might even be a
good idea to have zsh refuse to dynamically load modules when EUID==0, or
at least refuse to auto-load them.
} 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
(Safest.) This still isn't quite good enough -- you can't unload
modules upon which other modules depend, so if X has a wrapper and
depends on Y, you can't unload Y even though Y has no wrapper.
This probably means you end up refusing to unload any modules at all
whenever there are any wrappers at all, which may be problematic.
} the question is: how often does one want to unload modules in shell
I could envision someone wanting to write a pair of functions, one that
installs several related modules and another that uninstalls them again.
} 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.
Yes, as I said, if the only constraint is module dependencies this will
Side note to Phil Pennock: If we get this worked out, then an emulator
module for ksh would be the perfect way to fudge WORDCHARS and various
keybindings for later restoration ...
Bart Schaefer Brass Lantern Enterprises
Messages sorted by: