New syntax for string mixins
Don
nospam at nospam.com
Fri Dec 17 20:22:50 PST 2010
foobar wrote:
> Don Wrote:
>> Another one of the big differences is that D doesn't allow compile-time
>> code to call external functions. Although it could certainly be done, it
>> raises some big issues. Eg, we cannot assume that the target CPU is the
>> same as the one we're running on. With a JIT compiler, you don't have
>> that problem.
>
> Don, can you please elaborate on this point?
>
> Here's my understanding:
> The D compiler is run once to both 'execute' compile time code which you refer above as constant folding AND to generate the binary to execute at run-time.
>
> Nemerle separates this into two distinct steps:
> 1. you compile regular code inside macro definitions into a compiler plugin.
> 2. when compiling the intended run-time code you need to load the compiled macros from step 1 above on the command line of the compiler.
>
> Since you're talking above about cross-compilation and let's say we run the compiler on X and compile for Y, I see no problem to load precompiled macros for X in order to compile the code for Y. The only limit as far as I can see is that it won't be possible to load macros compiled by the such a cross compiler on X unless as you say JIT is employed. Perhaps it makes sense to disable macro definition in a cross-compilation scenario and only allow usage.
Suppose the pre-compiled code, when run, asks what CPU it's on. What's
the answer? Is it X or Y?
More information about the Digitalmars-d
mailing list