Compiler as dll
Christopher Wright
dhasenan at gmail.com
Tue Jan 27 04:24:29 PST 2009
bearophile wrote:
> In C# 4.0 the VM becomes a module of the standard lib, so it can be used from normal C# code, to do various things.
>
> While writing a genetic programming program (and in some other situations) I find it useful to have an eval() function, like in Lisp/Scheme and most scripting languages.
>
> I think such functionalities may be added to DMD and LDC too:
> - 99% of the compiler can be moved into a DLL (or a shared dynamic lib of some kind) and the DMD/LDC executable can then become very little, it can load such dynamic lib, and it has just to manage the I/O from/to disk and the command line arguments, ad little else.
> - By default such dynamic lib isn't loaded by D programs, so the size of D programs is unchanged (and they don't need such dll to run).
> - A module can be added to the std lib (Tango and Phobos) that loads such dll and offers a function like eval() that accepts in input a string of code (or an AST too, if you want) and compiles/runs it.
I think Walter would take Oren Eini's approach to this: send me a patch
for it.
> Bye,
> bearophile
More information about the Digitalmars-d
mailing list