Exception programming difficult

Marco Leise Marco.Leise at gmx.de
Fri Aug 17 01:02:54 PDT 2012


Am Wed, 15 Aug 2012 19:44:13 +0200
schrieb "SomeDude" <lovelydear at mailmetrash.com>:

> On Monday, 13 August 2012 at 08:00:33 UTC, Nathan M. Swan wrote:
> > Perhaps an annotation might be nice, as long as it doesn't 
> > force catching:
> >
> > void buggyFunction(string file, int exception) 
> > @throws(StdioException);
> 
> It's like saying adding typing to the language is nice as long as 
> it's not enforced by the compiler.

I am on the same boat, but the number of people who are annoyed by the excrescences is high. That's why I came to the conclusion that both of you should have their way. You can annotate (which means the buggyFunction can only throw StdioException), but you don't need to catch it on the caller side. (Unless you also add an @throws or nothrow there.)
Also, I want to repeat that @throws can be put into DDoc automatically, avoiding the manual documentation and resulting in more modern convenience.

-- 
Marco



More information about the Digitalmars-d mailing list