At 01:56 PM 7/29/02 +0200, Arthur Bergman wrote: >>At 10:44 AM 7/29/02 +0100, Tim Bunce wrote: >>>"Thread::Needs" isn't a very descriptive name - it's too general. >>>Something like "Thread::NeedsModules" would be better. >I have been thinking maybe it should be called Thread::Modules; >use Thread::Modules qw(foo bar baz); #these must be cloned >no Thread::Modules qw(don't need this); #these should not be cloned
Hmmm... it would be nice if you could mark modules not to be cloned. Unfortunately, at the current state of things, we can only remove module stashes _after_ they have been cloned ;-( Currently the "no Thread::Needs" removes module names from the hash of module names to be kept. I basically see two ways of dealing with modules in threads currently: an aggresive way (removing _everything_ except the stuff you specify should stay) and a non-aggresive way (just specifying those modules that you know you don't need). The problem with the first is that it may throw away too much. But you will save the most memory that way. The problem with the latter is that you only remove the modules of which you _know_ as an author that they're loaded. But any modules that have been loaded "under the hood" will remain in memory, even if you don't need them. I think the two approaches should not reside in the same module. I would therefore like to suggest the following: Thread::With and Thread::Without. So: Thread::With - mark modules to remain in thread memory Thread::Without - mark modules to be removed from thread memory Or maybe we should _interfix_ the word "Module" here? Thread::Module::With - mark modules to remain in thread memory Thread::Module::Without - mark modules to be removed from thread memory Or maybe we should _postfix_ the word "Module"? Thread::With::Module - mark modules to remain in thread memory Thread::Without::Module - mark modules to be removed from thread memory The "no" calls of these modules would then simply unmark the modules, either for keeping or removing. I think that would be a cleaner interface. Thread::Without would then be for the faint of heart, and Thread::With would be for the more brave and savvy developers... Liz