What's the best way to find out which exceptions may be thrown ?
Dennis
dkorpel at gmail.com
Wed May 27 11:03:37 UTC 2020
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.
More information about the Digitalmars-d-learn
mailing list