Checked vs unchecked exceptions

jag via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 27 14:47:49 PDT 2017


On Tuesday, 27 June 2017 at 19:37:24 UTC, Moritz Maxeiner wrote:
>
> As I have pointed out, your example occurs on the *caller* 
> side, not the *callee* side. The proper solution is not for the 
> callee to specify which exceptions it may throw, but for the 
> caller to specify which exceptions it allows the callee to 
> throw (using compile time introspection on the exception set).

Can I as a programmer who wants to call a function written by 
someone else inspect the declaration of that function and know 
what exceptions are possible? If no how is this supposed to work? 
I am supposed to specify that exceptions I want to allow the 
called function to throw? The called function is not going to 
dynamically adapt itself and change the list of exceptions it 
throws, right? So how can I know, before running the code, what 
exceptions are possible?



More information about the Digitalmars-d mailing list