[Issue 2370] Version statement enhancement: versioned identifiers

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Oct 3 13:46:26 PDT 2008


http://d.puremagic.com/issues/show_bug.cgi?id=2370





------- Comment #7 from snake.scaly at gmail.com  2008-10-03 15:46 -------
(In reply to comment #6)
> If you add a specific feature in a given version, it's best (clearer) to add a:
>   version = NiftyMyLibCallAvailable;
> and then use:
>   version(NiftyMyLibCallAvailable)
>   {
>     NiftyMyLibCall();
>   }
> instead of version numbers.

Is there *any* library around that has a version/#define for every single
interface and every single change in that interface?  I don't think so, it's
just not feasible.

> In any case, when releasing a new version:
> Your approach:
>   * go to the 'version = MyLibVersion(20);' statement
>   * change it to 'version = MyLibVersion(21);'
> 
> My approach:
>   * go to the 'version = MyLibVersion20OrAbove;' statement
>   * add a 'version = MyLibVersion21OrAbove;' statement
> 
> How is my approach any more tedious, error-prone, or less automated? They are
> both one line changes you have to make (mine has an extra copy&paste), and they
> are both dead easy to make. My approach may end up with more code written, but
> that's hardly ever more error-prone, since that code is not supposed to change
> or be maintained (one doesn't usually downgrade the version number of a lib).

A version number in one particular place can be replaced by a script, or by a
version control system.  It's significantly harder to add a line automatically.

Though adding a line for every version is definitely much better than adding a
version statement for every interface change.


-- 



More information about the Digitalmars-d-bugs mailing list