| |
 | Posted by Walter Bright in reply to Steven Schveighoffer | Permalink Reply |
|
Walter Bright 
| On 7/19/2022 6:34 PM, Steven Schveighoffer wrote:
> The thing I miss the most for versions is a `version1 or version2` mechanism. I doubt we will ever convince Walter this is a good idea.
I know what will happen if that is allowed, and it is not pretty.
The idea is to encourage people to work at teasing out just what should be a version and what shouldn't be, not have arithmetic decide what it is.
This can be faked with `static if` and some enums. Long ago, some users decided that druntime would be better served using `static if` arithmetic on enums instead of versions. Of course, what quickly emerged was the usual C snarl, and nobody knew what code was being compiled (it was made even worse by mutual dependencies). The problem was dropped in my lap, because nobody could figure it out. I didn't even try to figure it out, I figured out what the versions should be and removed all that `static if` nonsense.
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 :-)
> But in any case, we have the numeric versions, which are 100% useless (because, as you say, they are not scoped to any dependencies), it would make sense to at least make that feature useful.
Yes, the numbers are a failed idea of mine. I'd endorse deprecating them.
|