Cross module version specs

bcs bcs at example.com
Thu Apr 26 21:22:46 PDT 2012


On 04/26/2012 03:20 AM, Jonathan M Davis wrote:
> 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.
>

One monster of a string mixin?

>> 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