The main problem here is that one would expect a program written in Swift to be clearly deterministic, and always behave as expected with clear and understandable rules. Today, one ends up in the forums to know that deinit
will work almost always, but not always, and that we don't know when it won't work (because it might be optimized away).
The thing is, the language says: "deinit
will run when your objects come out of scope some times but not always. If you really, really want to do something like that. Create your own method and call it reallyReallyDeinitThisTime()
and call it explicitly." At this point, the usefulness of deinit
disappears.