On Monday, 26 June 2017 at 19:31:53 UTC, Moritz Maxeiner wrote:
And the good *way* to achieve this result would be the
following:
- When visiting `startFoo`, the compiler automatically
aggregates all different exceptions it may throw and stores the
resulting set
- If `startFoo` is going to be part of a (binary) library and
its symbol is exported, also export its exception set
- Improve the compiler's nothrow analysis such that if startFoo
is called in scope S, but all of the exceptions in its
exception set are caught (i.e. can't break out of scope S), it
is treated as nothrow in S.
- Enclose the call to `startFoo` in B in a nothrow scope.
After preparing my message I read tail of the thread and see
your vision very close to mine. 👍
So listing exceptions that can be thrown is a good thing
because it helps you write more reliable code.
It is a bad thing because you force a human to do a machine's
job.
This is a bad necessity, but a necessary opportunity. Sometimes
you need to be sure that the compiler's vision matches yours.