Versioning best practices

Lars Ivar Igesund larsivar at igesund.net
Thu Jan 25 10:52:34 PST 2007


Thomas Kuehne wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> BCS schrieb am 2007-01-24:
>> Thomas Kuehne wrote:
>>> Lars Ivar Igesund schrieb am 2007-01-24:
>>> 
>>>>I've been looking at what D and the compilers provide to help with
>>>>successfully versioning D source code in such a way that it minimizes
>>>>duplication of code (and in the process ease organization of said code),
>>>>ease readability and ease building.
>>> 
>>> [...]
>>> 
>>>>Do you think that the current tools are adequate?
>>> 
>>> 
>>> Most of the times versioning is the wrong approach. I think C's
>>> (and to a lesser extend C++'s) non-existing compile time reflection
>>> forced everyone to use versioning instead of "featuring".
>>
>> Shouldn't version be used for adding or not adding a feature? I'm
>> thinking of, for example, building a compiler with extensions where the
>> extensions are optional*.
> 
> Maybe we have different concepts of versioning.
> 
> C:
> #if USE_REENTRANT
> #if GLIBC > 1
> 
> The first line is a feature test while the second one is a version test.
> If you use D's "version(...)" to check features that's fine.
> 
> Versioning in the strict sense(line 2) however is usually not a good
> design - unless your are trying to bypass some library bugs, though fixing
> those should be the primary approach.
> 
> Thomas

Thus the conclusion is that version statements are not generally suitable
for handling versions in the sense that it is mostly used, but for feature
differentiation only. Maybe it should be called feature statement
instead? ;)

It do however pave a future road for a more complex build tool that can
handle versioned dependencies with grace. Quite possible that DSSS are
close, though.

-- 
Lars Ivar Igesund
blog at http://larsivi.net
DSource & #D: larsivi
Dancing the Tango



More information about the Digitalmars-d mailing list