DMD 1.027 and 2.011 releases
Walter Bright
newshound1 at digitalmars.com
Wed Feb 20 18:58:48 PST 2008
Graham St Jack wrote:
> It is also very helpful when writing code to know that a function you are
> calling won't throw an exception - it means you have three kinds of
> functions: those that don't throw, those with comments telling you what
> they throw, and those that you need to fix the comments for.
Experience with this indicates that it is impractical to specify what
exceptions a function may throw. The only practical states to specify are:
1) does not throw
2) always throws
3) might throw
What is thrown is not reliably computable. For example:
import foo;
void test()
{
foo.bar();
}
What exceptions does test() throw? That would require knowledge of the
import foo, which is not necessarily knowable and can change over time.
More information about the Digitalmars-d-announce
mailing list