How do you declare manifest constants?

Andrey Zherikov andrey.zherikov at gmail.com
Thu Nov 4 17:24:44 UTC 2021


On Thursday, 4 November 2021 at 17:09:31 UTC, Steven 
Schveighoffer wrote:
> D doesn't have any equivalent for this.

Is it possible to add this feature having `-C VERSION="1.2.3"` 
(`-D` is already used) to be equal to `enum VERSION="1.2.3"` in 
global namespace?

> The closest you can get is to turn on `version` identifiers.
>
> There is also a quirky `-version=123` which is IMO, a 
> completely useless feature.

I agree - this is useless. `-version myversion=123` would be much 
more useful.

> Note, there is at least one dub package which does this for 
> you: https://code.dlang.org/packages/gen-package-version

Unfortunately git/hg tags is not the only possible source of 
manifest constants.


More information about the Digitalmars-d-learn mailing list