Repository navigation
Description
As of right now, the "right" way to clean up after an application quit (or a SubProgram quit), is to manually cleanup prior to sending a .quit message.
This has two problems (at least personally in my own use):
- It's not clear if there is a possibility of a
view()happening in between the.quitmessage, and the application actually quitting, or the SubProgram no longer recieving.view()updates. And even if right now this isn't possible, there's nothing to say it can't in the future. - It can make destroying SubPrograms brought in from other applications (imagine a library that provides a certain view) quite difficult.
It would be nice if there was a final function to complement .init() just called .deinit(). It would need the context for destroying (ctx.persistent_allocator.destroy(), etc.).
The context I have for my own use is that my program has very clear and separate phases (without too much detail):
- Load the database
- Index files
- Upload diff to server
- Ask user for whatever input needed
- Execute on that input
- Quit
This is extremely well-suited to using a different view for each of these phases with a large MainView to control and contain each of these views. This means I use a lot of the zz.SubProgram() interface to keep state handled and less bespoke code for each view (e.g. a bunch of switch statements with a bunch of state enums or something awful like that).
As of right now, though I have to pass .quit messages up from these and run my own manual destroy on these models that I've wired up myself. It'd be nice if I can do just some sort of db_loader.deinit() function that will clean up not just the model itself (run DbLoader.deinit()), but also any memory that SubProgram might be using as well.
Activity