[OT] - C++ exceptions are becoming more and more problematic

rikki cattermole rikki at cattermole.co.nz
Wed Feb 23 16:37:34 UTC 2022


On 24/02/2022 5:20 AM, IGotD- wrote:
> I'm really against "manually" declaring which exceptions a function 
> throws. It will quickly become unmaintainable as people will forget 
> which exceptions that are thrown and which are not. This means that the 
> compiler must give an error when the exception was thrown which wasn't 
> declared. Also warn about exceptions not thrown when they are declared 
> so the compiler must track the exceptions anyway. Let the compiler do 
> it, that's what computers are for. Also let's be conservative with 
> @badging.

Okay that is easily rectified, we simply allow inheriting from the 
function body, not just called functions ;)

The reason it must support be declared in some form (which is how it is 
also represented in the AST) is due to it being value type. Its like as 
if you put a algebraic type for the return value with your declared 
return value + what can be thrown from it.


More information about the Digitalmars-d mailing list