DMD 1.027 and 2.011 releases

Leandro Lucarella llucax at gmail.com
Mon Feb 25 08:13:11 PST 2008


Walter Bright, el 20 de febrero a las 18:58 me escribiste:
> 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.

And what's the difference with nothrow? foo.bar's nothrow-ness "is not
necessarily knowable and can change over time". It's exactly the same,
you're just limiting the way you specify exceptions, but you are specifing
them after all.

This is like limiting C++ exception specification to nothing or an empty
throw() qualifier.

-- 
Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/
----------------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------------
Hace diez años tenía una visión
Pero nadie más la vió y hoy sigo pidiendo perdón


More information about the Digitalmars-d-announce mailing list