version(number) is completely useless
Andrey Zherikov
andrey.zherikov at gmail.com
Sat Jul 23 04:24:07 UTC 2022
On Thursday, 21 July 2022 at 03:57:31 UTC, Walter Bright wrote:
> If version arithmetic was added, it is guaranteed to produce a
> coding horror. But by then it will be too late to change our
> minds, and you and I will be stuck in hell.
>
> At least using `static if` on enums as versioning I have
> managed to discourage, like using operator overloading for I/O.
> It's also why enums cannot be set on the command line :-)
Unfortunately as you know people don't care about what you
discourage or encourage. People just try to express their intent
using those language structs that are the best for their needs
and nothing prevents them from writing this right now:
```d
static if (defined(_MSC_VER) && (_MSC_VER > 600) &&
!defined(__INTERIX))
{
static if(defined(_WIN32_WCE))
alias fdopen = (fd,mode) {}; /* No fdopen() */
else
alias fdopen = _fdopen;
}
```
(I took this example from
[zlib](https://github.com/madler/zlib/blob/master/zutil.h#L177))
More information about the Digitalmars-d
mailing list