On Sunday, 12 January 2014 at 18:36:19 UTC, Russel Winder wrote:
With C++ and Python, it is idiomatic to put the application
version
number in a separate file that can then be processed by the
build
system. For C++ a config file is constructed defining a macro
that is
then used in the rest of the course. For Python the file is
read at
runtime to define a variable. The build system itself uses the
version
number for creating deb, RPM, egg, wheel, etc. packages.
D has no macro processing so C++ idioms are not useful. D does
create a
standalone executable and so the Python approach of reading the
file at
initialization time seems inappropriate.
Is there a known D idiom for this?
Thanks.
Unless I'm misunderstanding you, this is what the -version and
verion(){} blocks are for. Past that it's really a matter of
choice depending on your build system.