Idea: Run Time Compilation

Russell Lewis webmaster at villagersonline.com
Fri Mar 9 09:04:32 PST 2007


Ok, ignore the bootstrap issues for a second, and consider: If the 
compiler were primarily implemented as a set of functions in the 
standard library, then we could view "static compilation" as CTFE of 
those functions...while "dynamic compilation" (a.k.a. runtime compiler) 
as ordinary, runtime execution.

Russ

Craig Black wrote:
> Since Walter is in the habit of adding super advanced features to D, I 
> thought it possible that this one might eventually make it in.  As always, 
> please let me know if I'm way off base.
> 
> What if we could invoke the compiler from an application at run time and 
> generate a function that would be instantiated on the heap?  The function 
> would be defined by a text string and would be invoked via a function 
> pointer or delegate.  This would allow a script-like capability with 
> fully-optimized performance provided by the D compiler.  I think the D 
> compiler would be ideal for this since it is so fast.  Since the method 
> would be allocated on the heap dynamically, it could also be removed when it 
> is done being used.
> 
> Thoughts?
> 
> -Craig



More information about the Digitalmars-d mailing list