D with minimal runtime

Adam D. Ruppe destructionator at gmail.com
Wed Jun 17 02:44:14 UTC 2020


On Wednesday, 17 June 2020 at 02:29:44 UTC, Andrei Alexandrescu 
wrote:
> possible if most parts of druntime would be templated and 
> others would only be pulled in if used.

I actually don't think it is even necessary to template it. If 
you had independent modules written with minimal dependencies, 
there's several things that make it work automatically: dmd -i 
can compile as-needed. Linkers can leave things out of exes from 
static libs. Etc.

My arsd package as like 78 modules now. But I'm strict about them 
not importing each other unless absolutely necessary. You can use 
most of them individually without caring about the other 77 (but 
if you do reference it, it gets auto-imported, e.g. 
Document.fromUrl brings in http... but if you never call that, no 
need for the http module at all in your build)

There's been some decent work in dmd to support this for language 
features too, but from the other direction. If a feature isn't 
present in object.d, it won't reference it. That little glue 
layer might be templatized so it is available, but not used 
unless needed... then from there it just imports a traditional 
module.

Pretty sure good chunks of that would work.

druntime and phobos too have problems of intertwined imports that 
would take a lot of work to clean up though.


More information about the Digitalmars-d mailing list