version(number) is completely useless

jfondren julian.fondren at gmail.com
Wed Jul 20 02:31:55 UTC 2022


On Wednesday, 20 July 2022 at 02:10:21 UTC, Andrey Zherikov wrote:
> It's not a full replacement because it doesn't support 
> `-DSOME_DEFINE=5` or `-DANOTHER_DEFINE="some string"`.
>
> One of the features which I really miss in D is inability to do 
> these things. This is very largely used in software development 
> for setting compile-time constants from command line. D doesn't 
> support this out of the box (I have to dump a `.d` file with 
> set of `enums` and then include it into the build).

And that works, right? When you definitely need the feature, 
enough to live with a build-system burden like this, then you can 
have it. And when you don't definitely need it, D's `version` 
feature doesn't let you casually, effortlessly, create an 
impossible to understand version soup.

Meanwhile, D makes it trivially easy to add a unit test whenever 
you want, and in some other languages unit testing is a feature 
that requires you to bear the burden of a more complex build 
system.

You can see the opinions of the language designers. Testing is so 
important that even a throwaway function posted to this forum can 
have a unittest{} with it. Elaborate build-time configuration is 
so detested that you have to ignore the relevant language feature 
and roll your own alternative to it.


More information about the Digitalmars-d mailing list