On 05.02.2013 16:37, Nick Kew wrote:
But in general, querying another module, or knowing anything about
its cleanups, would be a violation of modularity. If it's legitimate
for a module to expose its inner workings, it can do so by exporting
an API.
Why the questions? Are you writing two modules that relate closely
to each other?
I'm not writing them -- they already exist. The two Tcl-modules (rivet and
websh) both destroy the Tcl-interpreter at exit. The module, that gets to run
the clean up last usually causes a crash:
https://issues.apache.org/bugzilla/show_bug.cgi?id=54162
If each module could query, whether the other one is loaded too, the first one
could skip destroying the interpreter -- leaving the task to the last one. This
approach would work even if only one of them has been patched to do this.
The modularity is a great thing, of course, but when the modules use shared
data-structures (from another library -- such as libtcl), they better cooperate,
or else...
Yours,
-mi