Cross module version specs
Jonathan M Davis
jmdavisProg at gmx.com
Thu Apr 26 03:20:17 PDT 2012
On Thursday, April 26, 2012 12:09:19 James Miller wrote:
> All I can think is that version specifiers aren't carried across
> modules
They can't be. The only time that versions apply to your entire program is if
they're built-in or they're specified on the command line.
> which pretty much makes them completely useless unless
> you only use the built-in versions.
That's not true at all. It just means that versions are either useful for
something within a module or they're intended for your program as a whole and
passed on the command line (e.g. StdDdoc is used by Phobos, and it's not
standard at all; the makefile adds it to the list of compiler flags). But yes,
it's true that if you want to define a version in one module which affects
another, you can't do it.
The closest that you would be able to do would be something along the lines of
having a function in the imported module which returned the version statements
as a string which the module doing the importing mixed in. Another option
would be to just use static ifs, since they'd be affected by whatever variables
or enums where defined in the imported modules. e.g.
static if(is(myVersionEnum1))
{
}
else static if(is(myVersionEnum2))
{
}
- Jonathan M Davis
More information about the Digitalmars-d
mailing list