ctrl+c and destructors
deadalnix
deadalnix at gmail.com
Wed Oct 2 07:33:34 PDT 2013
On Wednesday, 2 October 2013 at 09:16:44 UTC, qznc wrote:
> On Tuesday, 1 October 2013 at 11:48:51 UTC, w0rp wrote:
>> This is a really good question, I think! Python has a
>> KeyboardInterrupt exception for this purpose. Should we perhap
>> try something similar? Perhaps as a library solution? I think
>> a function like some_module.registerInterruptExceptions()
>> would be cool to have. If someone knows a way to do that, that
>> would be cool. I'm looking at deadalnix...
>
> I don't like where this is headed. Converting signals into
> exceptions is a bad idea.
>
> In a multithreaded program, which thread should get the
> exception thrown? The main thread? Every thread? What if main
> already terminated?
>
> The InterruptException must be anticipated in lots of places
> and most people will forget about it.
>
> Basically, the issues are very similar to killing threads [0].
> Throwing exception anywhere without any relation to the code at
> that point is a recipe for disaster.
>
>
> [0]
> http://docs.oracle.com/javase/1.5.0/docs/guide/misc/threadPrimitiveDeprecation.html
The whole point of Exception is that you care about them only if
you know how to handle them.
Exception are the way a piece of code can say "Fuck that shit, I
have no clue how to proceed with that"
More information about the Digitalmars-d
mailing list