version(number) is completely useless

Andrey Zherikov andrey.zherikov at gmail.com
Tue Jul 26 15:19:44 UTC 2022


On Tuesday, 26 July 2022 at 13:27:55 UTC, H. S. Teoh wrote:
> On Tue, Jul 26, 2022 at 10:52:29AM +0000, Andrey Zherikov via 
> Digitalmars-d wrote: [...]
>> As a library developer I want to provide some SLA to the 
>> users: I guarantee that my library will be successfully built 
>> by all versions of all compilers (ldc,gdc,dmd) that are one 
>> year old or newer. The thing is that compilers evolve (they 
>> got new features, bug fixes etc) and I want my codebase evolve 
>> with them. I can easily check what compiler is used by 
>> `version(DigitalMars)` e.g.. But how should I check that a 
>> specific feature is added to compiler/phobos or a specific bug 
>> is fixed?
>```
> 	static if (__VERSION__ == 2098L) {
> 		... // 2.098-specific code
> 	}
> 	static if (__VERSION__ == 2100L) {
> 		... // 2.100-specific code
> 	}
> 	// and so on
>```

This is discouraged usage according to Walter, isn't it?


More information about the Digitalmars-d mailing list