Re: try , accept finally question

2018-02-03 Thread Araq
Use `raise` to terminate the program in a way that works with `finally`. It's interesting that C++ does this correctly, we should probably do the same.

Re: try , accept finally question

2018-02-02 Thread h42
Thanks for the suggestions. This wasn't really a huge problem for me. I was just surprised when some things were not being cleaned up properly in a program I've used regularly for a couple of years. Making assumptions is usually a bad idea but nim is still pre v1 so I was unsure if this was a co

Re: try , accept finally question

2018-02-02 Thread twetzel59
Yes, I agree. I should note that Nim does have [deconstructors](https://nim-lang.org/docs/manual.html#type-bound-operations-destructors), (*see my note below) but they are still, well, experimental (they require experimental mode) and have quite a few quirks. I wouldn't use them, and I am not

Re: try , accept finally question

2018-02-02 Thread h42
I was trying to simulate c++ destructor behavior which does work after system exit call. It is bit ugly having to do cleanup processing in two places. If this is the case, it might be a good idea to document when finally doesn't work in the manual.

Re: try , accept finally question

2018-02-02 Thread twetzel59
I don't claim to yet be a standard library expert in Nim, but I think that this is the intended behavior. `quit` is intended to be used as the final exit. It doesn't clean up resources and it doesn't handle exceptions. For example, according to the docs if a procedure registered with `addQuitPro

try , accept finally question

2018-02-01 Thread h42
When quit() is called in try block, the finally block is not executed. It is only executed after normal finish or exception is raised. I got around the problem I needed to solve with addquitproc but I am curious if this is how 'finally is supposed to work in nim. proc qproc(){.noco