@noreturn?

Timon Gehr timon.gehr at gmx.ch
Wed May 16 07:47:33 PDT 2012


On 05/16/2012 02:27 PM, Steven Schveighoffer wrote:
> On Mon, 14 May 2012 17:59:19 -0400, Timon Gehr <timon.gehr at gmx.ch> wrote:
>
>> On 05/13/2012 06:13 PM, Alex Rønne Petersen wrote:
>>> Hi,
>>>
>>> If memory serves me right, there were some proposals in the past to add
>>> a @noreturn attribute to the language. Where did this go?
>>>
>>> In writing unwinding mechanisms for my VM, I find myself actually
>>> needing some sort of @noreturn function attribute that would tell the
>>> compiler that the function does not return, rather than having to insert
>>> an assert(false); statement.
>>>
>>
>> What about making the compiler detect this pattern instead of adding
>> an attribute? I think it expresses exactly what you want to express,
>> and it does not require additional syntax.
>>
>> void foo()out{ assert(false); }body{ ... }
>
> Is the out contract required in a method signature? That is, is it valid
> to omit the out contract in the .di file?
>

Contracts are supposed to be part of the method signature. Due to a bug, 
they are not for DMD.

> If it's not required, then this doesn't work, since the compiler may not
> have access to that information.
>
> Of course, we could just say "don't make such functions opaque"...
>
> -Steve



More information about the Digitalmars-d mailing list