On Fri, 30 Mar 2012 10:39:09 -0400, Jacob Carlborg <[email protected]> wrote:
On 2012-03-30 14:52, Steven Schveighoffer wrote:
Why would there be ambiguities? Unlike C include files, D modules are
consistently compiled, unaffected by importing other modules.
What about static-if and string mixins?
This C code is what I'm talking about:
file1.h:
#define BLAH
file2.h:
#ifdef BLAH
int foo();
#else
char * foo();
#endif
main.c:
#include "file1.h"
#include "file2.h"
Note how including file1.h affects how file2.h is processed, with no
control given to file2.h. But in D this cannot happen, a module is
consistently processed, no matter how it's imported or in what order.
Therefore you can be confident that no matter how it was imported, it has
access to the same exact compiled code.
Neither static-if or string mixins cannot affect a file that does not
import them (directly or indirectly).
-Steve