[Issue 2370] Version statement enhancement: versioned identifiers

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Oct 3 08:53:10 PDT 2008


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





------- Comment #5 from snake.scaly at gmail.com  2008-10-03 10:53 -------
(In reply to comment #4)
> Like I said in the original thread, isn't it enough to have:
>   version(D_Version_2OrAbove) { ...
> ?
> Or just
>   version(D_Version1) { 
>     ...
>   } else {
>     //version 2 or above here...
>   }
> ?
> It doesn't seem this feature is justified.

Imagine I've got MyLib v.21.  There was nice API introduced in v.17 and I have
a special cased code which should work from version 17 on. In my approach:

module myapp;
import mylib;
version(MyLib, 17)
{
  NiftyMyLibCall();
}
else
{
  ...lots of code...
}

module mylib;
version = MyLib(21);

In your approach I'm either going to have 21 version statements in mylib which
is tedious, error-prone and is hardly automated, or I must have 5 version
clauses in my source which all mix in the same piece of code
and I must add new version clause every time a new version of lib is published.


-- 



More information about the Digitalmars-d-bugs mailing list