On Tuesday, September 20, 2011 14:02 Steven Schveighoffer wrote: > On Tue, 20 Sep 2011 15:58:06 -0400, Rishat Galiulin > > 2) Why D not using functions exceptions specification list like Java? If > > this promotes bad programming style to newbies, may be better at least > > to create compilation warnings? > > Not sure what the question is, D does not support exception specification > because exception specifications are too cumbersome to be useful. > However, it does support saying that a function does *not* throw > exceptions via the nothrow attribute.
Checked exceptions have generally been determined to have been a bad idea. They _seem_ like a good idea at first and do provide a number of benefits, but there are ultimately a number of problems with them. Java is the only language that I'm aware of that has checked exceptions. Both C# and D decided that they weren't a good idea and don't have them. This interview with one of the designers of C# gives some insight into the issues with checked exceptions: http://www.artima.com/intv/handcuffs.html Ultimately, it means that documentation needs to be clear about what exceptions something is expected to throw, and it does mean that it can be harder to make sure that your code is prepared for every exception type that it should be without catching Exception, but it still works quite well. Ideally, we'd have something that would statically verify that all of the appropriate exception types have been handled, but as far as I know, no one has really come up with a way to do that which doesn't have the problems that checked exceptions do. - Jonathan M Davis
