Exception programming difficult

Marco Leise Marco.Leise at gmx.de
Mon Aug 13 02:08:28 PDT 2012


Am Mon, 13 Aug 2012 10:50:47 +0200
schrieb Marco Leise <Marco.Leise at gmx.de>:

> I don't know how many there are who think like me. Your @throws proposal for example could be used to tell the compiler that I want Java style checked exceptions for this function and have the compiler check that I listed them all. An empty list would actually be 'nothrow' then.

It's actually funny if you consider following 2 sentences from http://docs.oracle.com/javase/tutorial/essential/exceptions/runtime.html :

"Any Exception that can be thrown by a method is part of the method's public programming interface. Those who call a method must know about the exceptions that a method can throw so that they can decide what to do about them."

So it is the _public_ programming interface, we should be worried about, not forcing "throws"-lists onto every function and method that isn't intended to be called by others, which would neatly work with an optional @throws.

-- 
Marco



More information about the Digitalmars-d mailing list