Exception programming difficult

Marco Leise Marco.Leise at gmx.de
Mon Aug 13 11:52:24 PDT 2012


Am Mon, 13 Aug 2012 20:17:12 +0200
schrieb "Nathan M. Swan" <nathanmswan at gmail.com>:

> On Monday, 13 August 2012 at 10:02:23 UTC, Marco Leise wrote:
> > Thoughts ?
> 
> I like this idea - you can use checked exceptions, but you aren't 
> forced.
> 
> Though I think private and free functions should by default just 
> use @throws(Exception). Not using @throws is like saying "I don't 
> pay attention to what errors might occur, a new version might be 
> different."
> 
> NMS

Ok, that would simplify the concept, but what would you do about templated functions that operate on ranges, like Dimitry presented? I'd rather have the compiler deduce the exceptions to @throws() where I passed in a simple int[], than have to deal with @throws(Exception). For normal functions it may be feasible.
Also all existing code is not annotated, leaving us in the same situation as with other missing attributes in Phobos and people start to complain "I'd like to use @throws, but everything is just @throws(Exception)" :p

-- 
Marco



More information about the Digitalmars-d mailing list