Thread overview
DUSE_MYLIB12
Feb 11, 2015
Dennis Ritchie
Feb 11, 2015
Vladimir Panteleev
Feb 11, 2015
Dennis Ritchie
February 11, 2015
Tell me, please, is it possible to set an arbitrary condition conditional compilation at the command prompt, type DUSE_MYLIB12 and in the code as:

version(USE_MYLIB12) {
       .....
}

And I didn't like Any DeclarationBlock or Statement that is not compiled in still must be syntactically correct:
http://dlang.org/version.html

It may be that using an optional library code is correct, and without it not?
February 11, 2015
On Wednesday, 11 February 2015 at 11:26:20 UTC, Dennis Ritchie wrote:
> Tell me, please, is it possible to set an arbitrary condition conditional compilation at the command prompt, type DUSE_MYLIB12 and in the code as:
>
> version(USE_MYLIB12) {
>        .....
> }

Specify -version=USE_MYLIB12 on the command line.

> And I didn't like Any DeclarationBlock or Statement that is not compiled in still must be syntactically correct:
> http://dlang.org/version.html
>
> It may be that using an optional library code is correct, and without it not?

No, that's not possible. Syntactically correct != semantically correct. It just means that the syntax rules of the language are respected, e.g. parens must be correctly nested (no [} or something like that). Since D libraries can't affect the syntax of the language, no code can be syntactically correct only in that library's presence.
February 11, 2015
Thanks.