On Saturday, 8 July 2017 at 12:17:57 UTC, Andrei Alexandrescu wrote:
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

I wonder if some lessons from Haskell's "bottom" type would be relevant here.

Reply via email to