On Wednesday, 27 May 2020 at 09:56:07 UTC, wjoe wrote:
The problem with catch(Exception) is that it's run time whereas I'd like to know compile time which exception may possibly be thrown.
Note that this is impossible in general due to the nature of classes. A function could at runtime find the latest trending hashtag on twitter, name a class after it that derives from Exception, invoke the compiler to generate a shared library that throws an exception with that class, load that library, and call the newly loaded function that throws the newly created exception class.
Obviously there's no way of knowing this class at compile time.