Close Stack Cleanup

Curry Kenworthy curry at
Thu Feb 4 18:17:50 EST 2021


 > I do not do any clean up at closing time. Instead I execute
 > the necessary routines as part of a preOpenStack handler.
 > I then do not have to consider which way the stack was closed.

Yes! Like you, for cleanup I also avoid that how-closed consideration.
Much easier to have a simpler single trap.

Yet I ALSO avoid saving user/test data!
That keeps my files smaller in their saved state.

And if opened with messages off, still cleaner....


 > when I open the stack the next time I do not want to
 > remains of what I was doing before to show.

You can! Several routes to choose. Presenting the easiest.

Me again:

 > I perform cleanup when I save.

In other words, try saveStackRequest!
Don't "save" with your own code; let LC IDE do that.
Just perform your cleanup, then pass.
That way your cleaned-up stack is reliably saved.

You get the best of both - simple trap, reliable.

(However, your original method would work - if you finish it!
And while typing this, I see you already made progress; that's good.)

Tore again:

 > By keeping it modular, the clean up script can also
 > be started from other handlers if necessary.

Modularity increases performance, maintainability, and freedom.
Can't stress this enough.

Me again:

Don't think "clean up and save." Keep the twain separate.
I choose when to save, it's a conscious choice, and it fires my cleanup.
My stack is almost always saved clean.

Moreover I'm in the habit of saving (and backing up) BEFORE closing.
Habits are so important - they avoid needless suffering.

If I do forget my habit, the IDE will prompt me to save.
So I'm still OK - because I haven't disabled the system. It's my backup.
Nor do I rely primarily on that system. It's my backup. ;)

Best wishes,

Curry Kenworthy

Custom Software Development
"Better Methods, Better Results"
LiveCode Training and Consulting

More information about the use-livecode mailing list