GemTalk / Rowan

a new project/package manager for Smalltalk that supports FileTree and Tonel repositories, and is independent of Monticello and Metacello
MIT License
14 stars 7 forks source link

When unloading a project, the postload doit gets executed #851

Open rjsargent opened 2 years ago

rjsargent commented 2 years ago

I was unloading the NeoJSON project to see how it reloaded when loading DataFrame from scratch. Both the preload doit and the postload doit were executed. However, since the postload doit was written to be executed after the code was loaded, it found an undefined symbol when compiling the expression. (As an aside, there should probably be preunload and perhaps even postunload doits, too.)

Stack report attached

PostLoadExecutedAfterUnloadingProject.log .

dalehenrich commented 2 years ago

Hmmm, as I think about it ... there is no way to tell whether or not a project is being loaded or unloaded ... at the point where the work doits are triggered, so I'm thinking that I will have to map the pre/post load/unload doits to the addition/removal of a package ... since we do know at this point whether or not a package is on it's way in or out ...

@rjsargent, hanks for being a guinea pig on this and we can chat if you have other thoughts ...

rjsargent commented 2 years ago

The sha for NeoJSON is 3a6a8dfcb, although any commit with the pre- and post-load do its will show it. The execution of the do its in general may go unnoticed, depending on what they do. I my case, they were trying to set up a Smalltalk global and associate it with a surrogate class (that no longer existed after being unloaded).

In terms of how to approach it, a property in the project could be used to discriminate between the normal loading case and the unloading case when deleting the project. e.g. it is initialized to 'load' normally, and the delete project code changes it to 'unload'. The file names can be composed from the string (not a secure practice) or conditionally from the state of the property.