What's the D way of application version numbers?
Russel Winder
russel at winder.org.uk
Mon Jan 13 11:17:50 PST 2014
On Mon, 2014-01-13 at 15:05 +0000, Dejan Lekic wrote:
[…]
> I simply define version in my main module (module which contains
> the main() function). I am planning to submit a DIP about
> something that is related to this. - I think we really need a way
> to specify version of package, and maybe even version of a module
> (similar to how the new Java module system works - see project
> Jigsaw). D does not offer this. I humbly believe it should be
> part of the language as it could be used also for building
> versions of dynamic libraries.
For the version number to be available to SCons it cannot be embedded in
the D source code. (Unless I am missing some really useful trick. :-)
> Anyway, back to the topic.
> Say my main() function is in the org.dlang.myapp module.
> If I want to have information about version of the artifact, my
> myapp.d starts with the following two lines of D code:
> module org.dlang.myapp;
> version = 1_3_21_4; // major_minor_micro_qualifier
Python uses a tuple:
(<major>, <minor>, <bugfix>, <annotation>)
which seems to work very well: it needs very little reprocessing to be
used in most contexts.
> Naturally, build tool looks for the version line when I need it.
--
Russel.
=============================================================================
Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder at ekiga.net
41 Buckmaster Road m: +44 7770 465 077 xmpp: russel at winder.org.uk
London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
More information about the Digitalmars-d-learn
mailing list