runtime evaluation

bearophile bearophileHUGS at lycos.com
Sat Dec 14 05:04:38 PST 2013


hoya:

> If I read it correctly, there is no possibility to create 
> classes, structs, templates, functions or to import libs at 
> runtime.

Right.


> Is there already an approach to add some functionality?
> I know, that D is a compiled language, but Java is too and 
> supports class loading at runtime or more in general: runtime 
> evaluation.

Java often runs on a JVM, so it keeps its compiler around at 
run-time, unlike most cases in D.

With enough work you can do the same in D with the LLVM, and keep 
the compiler as a service at run-time, if you want even as a JIT. 
But currently ldc2 doesn't have this feature.

Currently probably you can synthesize D source code, save the 
source, call the D compiler from D, and use it as library.

Bye,
bearophile


More information about the Digitalmars-d mailing list