Built-in sumtypes, case and noreturn: why block enders should be expressions.
FeepingCreature
feepingcreature at gmail.com
Wed Oct 26 05:53:21 UTC 2022
On Tuesday, 25 October 2022 at 13:31:48 UTC, Dukc wrote:
> 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?
That doesn't work. How would it? D has no idea that abort can
never return if it's not typed `noreturn`. (Neither works, to be
clear.)
More information about the Digitalmars-d
mailing list