Checked vs unchecked exceptions

crimaniak via Digitalmars-d digitalmars-d at puremagic.com
Thu Jul 6 03:59:01 PDT 2017


On Thursday, 6 July 2017 at 01:31:44 UTC, Moritz Maxeiner wrote:
> ---
> void foo() throws AException throws BException { ... }
> vod bar() { foo(); }
> ---
>
> works and bar's exception is inferred by the compiler to 
> contain AException and BException.
>
> But to be clear (and the title and description of any DIP 
> addressing this should reflect this):
> These are not checked exceptions, because checked exceptions 
> would require bar to declare its exception set manually.
  Not checked in sense of Java, but Java has no deductible 
exceptions. If compiler will fail on `void bar() { foo(); } 
throws AException;` we still can call it 'checked', I think. In 
sense of D.



More information about the Digitalmars-d mailing list