proposed @noreturn attribute

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Sun Jul 9 15:28:50 PDT 2017


On 07/09/2017 03:12 PM, Walter Bright wrote:
> On 7/9/2017 6:13 AM, Andrei Alexandrescu wrote:
>> We should use typeof(assert(0)) for Bottom. There is precedent - there 
>> is no name for typeof(null).
> I had forgotten about the typeof(null) thing. You're right. But there 
> are some issues. What do we do with:
> 
>      typeof(assert(0))* p;
> 
> ? What does that mean?

That would be a pointer that may only be null - a consequence of the 
typeof(assert(0)) being uninstantiable.

Generally I'm not too worried about constructs like typeof(assert(0))[], 
typeof(assert(0))*, use in templates etc - we don't need to "design" 
these cases, their behavior flows from the properties of 
typeof(assert(0)) itself.

Similarly, I don't recall ever there being a problem with typeof(null)*, 
typeof(null)[], people complaining they passed typeof(null) to a 
template where it did bad things, etc.


Andrei


More information about the Digitalmars-d mailing list