Why exceptions for error handling is so important
via Digitalmars-d
digitalmars-d at puremagic.com
Tue Jan 13 15:47:55 PST 2015
On Tuesday, 13 January 2015 at 23:40:41 UTC, deadalnix wrote:
>> 1. Restricting the exception object to 512 bytes, preallocated
>> in TLS.
>>
>
> Exception can bubble from one thread to another.
How? If you are thinking coroutines, then the exception can be
moved with it.
>> 2. Only have one exception in flight per thread
>>
>
> I don't see how you could have more.
In a catch you can throw a new one and initialize with the old,
but if they are both in the same memory space it will go wrong.
>
>> 3. Require that the first 8 bytes of the exception buffer are
>> 0 when no exception is in flight, and use them for encoding
>> exception type when one is in flight.
>>
>
> The first 8 bytes are already what is used to do matching. But,
> because of inheritance, it is not as simple as you think it is.
> Also, who the fuck care what is in the buffer when no exception
> are in flight ?
1. So that you can mark a non-D function with @checkexception and
allow it to both cast D-exceptions and propagate D-exceptions.
> Skipping 4 and 5, you obviously didn't though that through.
?
More information about the Digitalmars-d
mailing list