On Friday, 5 April 2013 at 19:39:14 UTC, John Colvin wrote:
On Friday, 5 April 2013 at 13:42:02 UTC, deadalnix wrote:
Right now, it isn't even possible to try a graceful shutdown
when really, the program is unlikely to be in a completely
unpredictable state, especially in @safe code.
It is possible. Catch the error.
No.
At this point, the small issue is already transformed in complete
havoc. Mutexes are not released, nothing is cleaned up, etc . . .
However, having the language pretend that it can make any
logical guarantees to you like it does with exceptions (i.e.
finally blocks, chaining etc.) only encourages people not to
take Errors as seriously as one should.
Soon people are throwing errors where they should be exceptions
and vice versa. Even worse: people will be catching errors
everywhere and their code could be happily running for days
performing undefined behaviour.
Well go all the way down the reasoning : nothing ensure that the
stack isn't corrupted and that unwinding is possible.
This is a similar situation to shared (although with some
important differences). Making it easier to use would be like
putting a seatbelt on a motorbike. Sure, it might be safer some
of the time. It'll definitely require less care to use. But
when the bike slips sideways underneath you going round a bend
at 80mph, you need to kick it away as fast as possible.
It'll save you all the times it *doesn't* matter, but it'll
kill you that one time when it *does*.
I'm not sure a media player can kill me.