proposed @noreturn attribute
Andrei Alexandrescu via Digitalmars-d
digitalmars-d at puremagic.com
Sat Jul 8 05:17:57 PDT 2017
On 7/8/17 6:15 AM, Walter Bright wrote:
> Has anyone a better idea? Does anyone want to write a DIP for this?
An attribute is fine. A more PL-minded possibility is to return a
specific type:
struct None
{
@disable this();
@disable this(this);
@disable @property None init();
}
None ThisFunctionExits();
The compiler detects (without having anything hardwired about the
particular type "None") that the type None is impossible to create and
copy/move from a function, and therefore decrees the function will never
return.
Andrei
More information about the Digitalmars-d
mailing list