Register based error-handling?
Jeremy Powers via Digitalmars-d
digitalmars-d at puremagic.com
Thu Nov 6 11:18:03 PST 2014
On Thu, Nov 6, 2014 at 1:17 AM, Jonathan Marler via Digitalmars-d <
digitalmars-d at puremagic.com> wrote:
>
> One thing I like about your suggestion is you can specify if a function's
> error code should be verified to be handled at compile time. It would be
> nice as a library writer if you could specify that the error MUST be
> handled by the caller. That way you have some protection that users will
> use your functions correctly.
>
>
This is why checked exceptions were invented.
Personally I prefer exceptions over error codes, as any sufficiently
advanced use of error codes will start to resemble exceptions anyway... But
whichever, there is still the need to enforce that an error case/exception
is actually handled (or explicitly not).
I'd really like a language-enforced way to do this. Don't have any better
suggestion than checked exceptions though...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20141106/628d1dde/attachment.html>
More information about the Digitalmars-d
mailing list