version(number) is completely useless

Andrey Zherikov andrey.zherikov at gmail.com
Wed Jul 20 02:39:03 UTC 2022


On Wednesday, 20 July 2022 at 01:38:41 UTC, jfondren wrote:
> A few seconds of hacking with a build system though, and static 
> if seems to be enough:
>
> ```d
> import mbs = magic_buildsystem_definitions;
>
> enum Test = true;
>
> void main() {
>     import std.stdio : writeln;
>
>     static if (mbs.Test) {
>         writeln("true");
>     } else {
>         writeln("false");
>     }
> }
> ```
>
> with that module generated of course by the build system, and 
> any logic you like now capable.

I'd like build system to not generate any files with compile-time 
constants.

> version's limited expressiveness is due to experience with 
> `#ifdef` abuse in C, much like (I imagine) limitations like 
> "the code won't even compile if you're not using an import" 
> exists in Go. You could positively say that such limitations 
> are lessons learned and you could negatively say that they're 
> expressions of trauma.

I'm not sure I got what `#ifdef` issue is referenced. Is it 
something like the one described in 
https://www.usenix.org/legacy/publications/library/proceedings/sa92/spencer.pdf?


More information about the Digitalmars-d mailing list