Value Type Exceptions
IchorDev
zxinsworld at gmail.com
Sun Sep 22 10:25:41 UTC 2024
On Thursday, 19 September 2024 at 18:31:02 UTC, Richard (Rikki)
Andrew Cattermole wrote:
> - Did I mention the throw set is inferred? Sadly it cannot
> shrink down to the empty set due to virtual functions/function
> pointers, but we could change that with an edition if it's
> desirable to do so.
>
> ```d
> int toCall() @throw(:FailedToDecodeUTF) {
> throw :FailedToDecodeUTF;
> }
>
> int caller() /* @throw() */ {
> int result;
>
> try {
> result = toCall();
> } catch(:FailedToDecodeUTF) {
> result = 0xDEADBEEF;
> }
>
> return result;
> }
> ```
But if `caller` is manually marked nothrow then it wouldn’t be a
compiler error anymore just because you didn’t catch `Exception`?
Also, could you elaborate on what `:FailedToDecodeUTF` is in this
situation? Like, what exactly is it a member of?
More information about the dip.ideas
mailing list