|
|
|
|
|
by dllthomas
3962 days ago
|
|
This would seem to be "just" a matter of correctly handling polymorphism along yet another axis. Let's say we had the following C++ code: int foo(int (*bar)(char), int (*baz)(), char c) {
try {
return bar(c)
} catch(SomeException &e) {
raise otherexception;
}
}
What exceptions can be raised by foo?The answer is simply computed - "anything raised by its first argument except SomeException, plus the type of otherexception". Such a system would be tremendously more flexible than Java's checked exceptions, while still allowing you to confidently restrict what might be thrown in a section of code. |
|