version(number) is completely useless

Andrey Zherikov andrey.zherikov at gmail.com
Wed Jul 20 03:54:40 UTC 2022


On Wednesday, 20 July 2022 at 02:44:28 UTC, Steven Schveighoffer 
wrote:
> `version(a) version(b)` accomplishes a && b. But a || b is just 
> a complete pain to write.

Does this solve the issue?
```d
version(a)
     version = a_or_b;
version(b)
     version = a_or_b;
version(a_or_b)
     // do whatever you need
```


>>> 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.
>> 
>> I don't see how raw numbers can be useful. Could you clarify 
>> your idea?
>
> The proposal here (I think) is that if you define version 
> `MyLibrary.5` then `version(MyLibrary.4)` or 
> `version(MyLibrary.1)` all are enabled.
>
> What the current system does is worthless, because `version(5)` 
> has no meaning. If we scope the numbers to be within a specific 
> project, then that project has the ability to define what those 
> things mean, and you can just define one version on the command 
> line.

Scoping to a project doesn't always provide the meaning: if I 
have a library that does network communication then what is this 
version number - library version, protocol version or something 
else?




More information about the Digitalmars-d mailing list