Why exceptions for error handling is so important

ketmar via Digitalmars-d digitalmars-d at puremagic.com
Sun Jan 11 05:42:03 PST 2015


On Sun, 11 Jan 2015 14:32:21 +0100
Andrej Mitrovic via Digitalmars-d <digitalmars-d at puremagic.com> wrote:

> On 1/11/15, Dicebot via Digitalmars-d <digitalmars-d at puremagic.com> wrote:
> > What is your opinion of approach advertised by various functional
> > languages and now also Rust? Where you return error code packed
> > with actual data and can't access data without visiting error
> > code too, compiler simply won't allow it.
> 
> Or a @noignore attribute. Just having that alone could easily catch
> the mistake of ignoring a return value. I'm really rooting for this,
> but is anyone else on board?
`if (myfunc()) {}` ;-) it's still easier than
`try myfunc() catch (Exception) {}`.

this is a question of "opt-in" versus "opt-out". i believe that ignoring
errors should be "opt-in", not vice versa. and unhandled error MUST
bomb out the app.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20150111/1517a4da/attachment.sig>


More information about the Digitalmars-d mailing list