DConf 2013 Day 3 Talk 2: Code Analysis for D with AnalyzeD by Stefan Rohe

bearophile bearophileHUGS at lycos.com
Wed Jun 12 15:14:25 PDT 2013


Ary Borenszweig:

> But if a type checker deduces a function foo throws exception 
> A, and in function bar you call foo: are you forced to handle 
> the exception? If not, do you have to tell the compiler that 
> you don't want to handle that exception? Isn't that the same as 
> what Java does?

Let's keep playing :-)

- I think if you don't want to handle the exception, you don't 
handle the exception, and the type system assumes you will handle 
the exception at a higher level.
- In every point of the program you can also ask to the type 
system (like through the IDE) what are the current exceptions 
that can happen there.
- If you don't handle exceptions in the main, your program will 
throw them. If you annotate a function with nothrow then the type 
system forces you to handle all the possible exceptions of that 
function inside the function.

Bye,
bearophile


More information about the Digitalmars-d-announce mailing list