Built-in sumtypes, case and noreturn: why block enders should be expressions.

Dukc ajieskola at gmail.com
Tue Oct 25 13:31:48 UTC 2022


On Tuesday, 25 October 2022 at 13:12:22 UTC, FeepingCreature 
wrote:
> On Tuesday, 25 October 2022 at 10:04:50 UTC, Dukc wrote:
>> It does not though. The implementation does not currently 
>> convert the bottom type to `throwable`. If this is allowed, 
>> should it be allowed in `nothrow`? What about `@safe`? I tend 
>> to think that yes but not sure.
>
> Wow.
>
> ```
> extern(C) noreturn abort();
> noreturn foo() nothrow { throw abort; }
> ```
>
> That is truly evil.

Why it'd be evil? It aborts with the C function, it doesn't 
actually throw.

No more of a problem than

```D
extern(C) Throwable abort();
noreturn foo() nothrow { throw abort; }
```

...which I believe currently works. Or is that a problem too?


More information about the Digitalmars-d mailing list