version(number) is completely useless
Steven Schveighoffer
schveiguy at gmail.com
Wed Jul 20 13:49:40 UTC 2022
On 7/19/22 11:54 PM, Andrey Zherikov wrote:
> 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
> ```
That's the pain I'm referring to.
>>
>> 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?
version(MyLibrary.5) ... // library version
version(MyLibrary_protocol.5) ... // protocol version.
-Steve
More information about the Digitalmars-d
mailing list