[Modules] unloading difficulties...

Henrik Gedenryd h.gedenryd at open.ac.uk
Thu May 9 14:38:38 UTC 2002


danielv at netvision.net.il wrote:

> After that, I needed to move MailNotifier into this new module. I tried
> to edit the class definition, as I would to change categories. This
> didn't work, it offered to create a new class.
> Q2: Why, is that the most common thing to do? when would I do that?

Since there are  (multiple) namespaces the effect is to create a new
definition of that name in the module that is specified. That is the natural
interpretation of a definition message.

> By reading through the ModuleRefactorer class, I found out about
> mailModule moveName: #MailNotifier toModule: mailNotifierModule.
> So I moved the class, and then I wanted to unload it. I decided not to
> define it's prerequisites first. I did
> ModuleInstaller unload: self
> on the module, it complained and offered to determine dependencies by
> itself, warning this might not work.
> Q3: When might it not work? what might be the bad effects?

When there are bad cycles; loading fails; see the answer to Stephen's
message for details. Or if there is a bug in the analysis of course.

> I accepted, it worked, the class disappeared. In the ModuleExplorer,
> however, the entry was still there, with the following printString:
> '#(''stray-Module'' ''bad parent, #2857'')'. It still has it's neighbour
> refs, the other variables are emptied.
> Q4: Huh? what happened, how do I fix it, how do I avoid it, or should I
> just start reading code now?

The ModuleExplorer itself is holding on to the last reference to the object,
which has been removed from the module hierarchy.

> would be great to have such a
> nice GUI

yes indeed... The ModuleRefactorer has the code, and its subclasses provide
some concrete examples of how to use it to this end.

Henrik




More information about the Squeak-dev mailing list