Re: externally imposed conditional compilation

2012-11-23 Thread Peter Alexander
On Friday, 23 November 2012 at 11:38:31 UTC, Gor Gyolchanyan wrote: What's the best/standard way translating this to D? One way is to use import expressions: import std.stdio; import std.conv; enum value = import("value").to!int(); void main() { static if (value < 100)

Re: externally imposed conditional compilation

2012-11-23 Thread Vladimir Panteleev
On Friday, 23 November 2012 at 22:20:39 UTC, Gor Gyolchanyan wrote: I thing another way is to have the entire module a template and instantiate that template with necessary parameters. Although that means one has to have an additional namespace. Mixin the template into the module scope? http:

Re: externally imposed conditional compilation

2012-11-23 Thread Vladimir Panteleev
On Saturday, 24 November 2012 at 05:55:49 UTC, Gor Gyolchanyan wrote: In case of WinAPI itself, which takes a dozen of preprocessor definitions, would you like a WinAPI binding, where you need to mix in the WinAPI? I believe the bindings on dsource use a sensible solution. It is similar to wh

Re: externally imposed conditional compilation

2012-11-25 Thread Jacob Carlborg
On 2012-11-23 12:38, Gor Gyolchanyan wrote: 2. I can't use static if because: 2.1. I can't define FOOBAR from outside of the package this code will be in. 2.2. I can't include the definition of FOOBAR into the package (like config.d) and expect it to be changed as necessary, because th

Re: externally imposed conditional compilation

2012-11-26 Thread Gor Gyolchanyan
Nice idea, especially with the template to make things easier. Still it looks ugly. Version identifiers and numbers (as well as debug identifiers and numbers) serve a very good purpose (parametrizing modules), but they're vastly incomplete. There's so much useful stuff that could be done if module

Re: externally imposed conditional compilation

2012-11-26 Thread Gor Gyolchanyan
I'd go one step forward to also allow UDAs on packages. This will be very useful for conditionally compiling entire libraries, instead of manually setting the same UDAs for every module in the package. On Tue, Nov 27, 2012 at 11:22 AM, Gor Gyolchanyan < gor.f.gyolchan...@gmail.com> wrote: > Nice

Re: externally imposed conditional compilation

2012-11-26 Thread Jacob Carlborg
On 2012-11-27 08:22, Gor Gyolchanyan wrote: Nice idea, especially with the template to make things easier. Still it looks ugly. Version identifiers and numbers (as well as debug identifiers and numbers) serve a very good purpose (parametrizing modules), but they're vastly incomplete. There's so m

Re: externally imposed conditional compilation

2012-11-26 Thread Jacob Carlborg
On 2012-11-27 08:25, Gor Gyolchanyan wrote: I'd go one step forward to also allow UDAs on packages. This will be very useful for conditionally compiling entire libraries, instead of manually setting the same UDAs for every module in the package. How would that work? You cannot declare a package