bottom type as parameter or local variable, does that make sense?

Paul Backus snarwin at gmail.com
Mon Jan 17 18:11:09 UTC 2022


On Monday, 17 January 2022 at 18:05:10 UTC, H. S. Teoh wrote:
> On Mon, Jan 17, 2022 at 05:57:19PM +0000, Paul Backus via 
> Digitalmars-d wrote:
>> 
>> I think the best way to describe the behavior specified by the 
>> DIP is that the compiler rewrites
>> 
>>     noreturn x;
>> 
>> to
>> 
>>     noreturn x = void;
>> 
>> So, there is a special case here, but it does not require 
>> noreturn to have a default constructor.
>
> The question then would be, why such a special case?  There's 
> no need to have a special case here, since aborting/terminating 
> on declaring a variable of type noreturn is perfectly 
> reasonable semantics for a bottom type.

Both the rewrite I describe and the behavior you propose are 
special cases. The non-special-case behavior is "compile-time 
error."


More information about the Digitalmars-d mailing list