proposed @noreturn attribute
Martin Nowak via Digitalmars-d
digitalmars-d at puremagic.com
Sat Jul 8 16:36:15 PDT 2017
On Saturday, 8 July 2017 at 12:17:57 UTC, Andrei Alexandrescu
wrote:
> 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.
That's a lot more complex (for the compiler and to explain) than
using a simple magic @noreturn attribute.
Agreed that this is rarely needed but sometimes nice to have. Far
from being important though ;).
More information about the Digitalmars-d
mailing list