CTFE and Wasm

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Sat Apr 30 10:29:06 UTC 2022


On Saturday, 30 April 2022 at 09:50:26 UTC, Dukc wrote:
> I think I now get it. You're talking about making D a fully 
> interpreted language, capable of inspecting types and compiling 
> code at runtime. That'd be great. But it'd also be a very big 
> project to implement.

That would be one way to do it, and that would allow for more 
easy protyping of language changes, but what I am suggesting is 
to make the compiler a service with a debug port that allows you 
to inspect the meta programming "resolution". Since Google has 
made webasm debuggable for any language using source maps, then 
that could be an option.

> Perhaps, just perhaps, I could see it to happen if it meant 
> embedding DMD as an optional component to DRuntime, and any 
> runtime code generation would invoke it.

Think more like this: the compiler is a server that allows you to 
hook into its internals. One way is to think of the compiler as a 
webserver with a remote client running in a browser that allows 
you to set breakpoints and get info about what is going on. 
Thanks to source maps that client can be very simple.

> But devising a WASM or LLVM intermediate representation system 
> for the langauge is just way beyond what we could tackle with 
> the present contributor force.

I get that, but it is at least an idea worth thinking about: 
leveraging existing technology for jailed execution of code to 
get better tooling.



More information about the Digitalmars-d mailing list