static version proposal

Daniel Murphy yebblies at nospamgmail.com
Fri Sep 23 06:24:16 PDT 2011


This is the way to do it in D:

// ---------- first module ----------
module first;

enum USE_MY_API = true;

/*
 * My API implementation.
 */

// ---------- second module ----------
module second;

import first;

static if (USE_MY_API)
{
    // My API usage.
}

One idiom used in C/C++ is
#if API_VER >= 0xABCD
    ....
#end if
Which naturally maps to static if, which can refer to symbols in other 
modules. 




More information about the Digitalmars-d mailing list