On Thursday, 24 August 2023 at 17:03:20 UTC, Walter Bright wrote:
>You wrote that this is in hundreds of places in druntime. Great! If this technique wasn't used, I guarantee that any port to AdrOS will miss more than a few, and it will be hell to figure out what is going wrong. I guarantee it because it always happened when defaults were used for unknown systems.
I understand this point, but it doesn't take out what Adam said. Sometimes you're coding for a platform where DRuntime isn't ported to, without intention to port it in whole.
I think we want to let the user to pick. By default, unimplemented DRuntime functions would cause a compilation failure, but that could be suppressed with -version=Autostub
. Therefore, the versioning would be:
else version(Autostub){}
else static assert(0, "Not implemented!");
Alternatively for less verbose syntax, object.d
would have
version(Autostub) enum autostubbing = true;
else enum autostubbing = false;
...making the versioning tail look like:
else static assert(autostubbing, "Not implemented!");