version(number) is completely useless

apz28 home at home.com
Wed Jul 20 17:55:20 UTC 2022


On Tuesday, 19 July 2022 at 22:30:28 UTC, Hipreme wrote:
> version(number) actually contains something really nice on it. 
> But it is useless.
>
> For example: version(3) would actually declare version(2) and 
> version(1).
>
> The problem is that these doesn't mean anything at all, but 
> they have this property of waterfall. Which is totally missing 
> in D right now. Take this as an example:
>
> ```d
>
> version(V1_3)
>     version = V1_2;
> version(V1_2)
>     version = V1_1;
> version(V1_1)
>     version = V1_0;
> ```
>

D Version is very limit. It should expand to include the version 
number
version(string-part.float-part)
ex: version = foo.1.3
string-part = foo
float-part = 1.3
true usage =
    version(foo >= 1) {with version check}
    version(foo) {without version check}
false usage
    version(foo >= 2) {never compiled block}

ex: version = foo
string-part = foo
float-part = 0.0

Anyway, "static if" construct is not same as version
https://issues.dlang.org/show_bug.cgi?id=16666





More information about the Digitalmars-d mailing list