Conclusions of the exception discussion

Daniel Murphy yebblies at
Sat Feb 25 05:11:35 PST 2012

"deadalnix" <deadalnix at> wrote in message 
news:jiagbg$liu$1 at
> Le 25/02/2012 07:26, Daniel Murphy a écrit :
> I do think this approach have a flaw. If we go in that direction, then it 
> push devs to create new Exception type just to catch them, because this is 
> the only way we have.

This is a different issue to whether or not we have the syntax to catch 
multiple exceptions with a single catch block.

> If I understand properly your pull request, the compiler will be 
> duplicating catch block ? If it is the case, would it be possible to use 
> static if to use type specific stuff of E1, E2 or E3, depending on which 
> one we are facing ?

No, it just creates stub catch blocks that jump to the real one. 
Duplicating the blocks would have weird effects on things like static 
variables.  I think that kind of code duplication is better done with 
something that works like mixing in case statements.

catch(auto e : E1, E2) { body; }

catch(E1 e)
  goto catchE2;
catch(E2 e)

More information about the Digitalmars-d mailing list