version(number) is completely useless

Andrey Zherikov andrey.zherikov at gmail.com
Wed Jul 20 14:37:59 UTC 2022


On Wednesday, 20 July 2022 at 13:49:40 UTC, Steven Schveighoffer 
wrote:
> version(MyLibrary.5) ... // library version
> version(MyLibrary_protocol.5) ... // protocol version.

What I don't like here is an assumption that `MyLibrary.5` is 
compatible with `MyLibrary.4`,`MyLibrary.3` etc. This might not 
be the case: versions might be backward incompatible so you will 
have to do `version(MyLibrary.5 && !MyLibrary.4 && !MyLibrary.3 
&& !MyLibrary.2 && !MyLibrary.1)`. And here are the problems: we 
don't wave `&&` (yes, you can substitute it with multiple 
`version`) and `!` (you have to do `version(bla) {} else {...}`). 
All these workarounds keep me away from using `version` - the 
only thing I use is `version(unittest)`.



More information about the Digitalmars-d mailing list