@disable("reason")

Simen Kjærås simen.kjaras at gmail.com
Wed Jan 8 11:54:06 UTC 2020


On Wednesday, 8 January 2020 at 07:03:26 UTC, Jonathan M Davis 
wrote:
> you could just document that no one should ever use its init
> value explicitly, and that they will have bugs if they do

You also create a static init member marked @disable:

struct S {
     @disable this();
     @disable static S init();
}

This will give sensible error messages anywhere .init is being 
used. Now, Phobos and other libraries might expect that .init is 
always working, so this could potentially be a problem.


More information about the Digitalmars-d-learn mailing list