No need for version expression is a lie
Dukc
ajieskola at gmail.com
Thu Aug 24 17:39:34 UTC 2023
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:
```D
else version(Autostub){}
else static assert(0, "Not implemented!");
```
Alternatively for less verbose syntax, `object.d` would have
```D
version(Autostub) enum autostubbing = true;
else enum autostubbing = false;
```
...making the versioning tail look like:
```D
else static assert(autostubbing, "Not implemented!");
```
More information about the Digitalmars-d
mailing list