Le 25/02/2012 14:11, Daniel Murphy a écrit :
"deadalnix"<[email protected]> wrote in message
news:[email protected]...
Le 25/02/2012 07:26, Daniel Murphy a �crit :
https://github.com/D-Programming-Language/dmd/pull/738
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)
{
catchE2:
body;
}
Wow, it didn't got that. This is nice, but then, the Exception type is
completely lost.
It does means that we are not interested in the Exception type, but of
its presence, and so, maybe we just have created useless Exception types
and this has to be fixed instead of the language ?