quit()
Danger: In almost all cases, in particular in library code,
prefer alternatives, e.g. doAssert false or raise a Defect.
quit bypasses regular control flow in particular defer, try,
catch, finally and destructors, and exceptions that may have
been raised by an addExitProc proc, as well as cleanup code
in other threads. It does not call the garbage collector to
free all the memory, unless an addExitProc proc calls GC_fullCollect.
Bob: so system.quit is not recommended, what's the best way to quietly quit a program?
Ralph: I don't know what is wrong with quit()
Well, I would raise an exception and let the program terminate as usual
Ted: Problem with quit is when it’s used in some library code.
I don’t want my libraries to terminate my app.
So I would say it’s an anti-pattern in apps too.
Eventually you’ll refactor into some libraries and run into issues.
Exceptions are indeed the way to go