mirage / functoria

A DSL to invoke otherworldly functors
ISC License
63 stars 21 forks source link

Replace dynlink method by a 2-stage build #171

Closed TheLortex closed 5 years ago

TheLortex commented 5 years ago

Hi, this is quite a heavy PR. I can try to minimize the diff if you want.

Why

The dynlink method to load config.ml feels quite fragile, as it requires mirage and config.ml to be built with the same code / options. When compiling using dune, these assumptions can be broken:

Proposal

Instead of dynlinking config.ml, we can perform a 2-stage build of the configuration ! (1) Locally build config.ml (2) Execute config.ml, which calls some entry function in Functoria_app

There are several ways of doing it:

I've implemented the intermediate solution. This is probably far from perfect but I'd like to have feedback on that :)

cfcs commented 5 years ago

@TheLortex I'm super excited about this since I think it can pave the way for external device types/implementations. I cannot get this to build though, can you link to the corresponding mirage branch?

TheLortex commented 5 years ago

The PR currently breaks API with Mirage, but it's not necessary, I'm waiting for comments on this.

There are two branches of https://github.com/TheLortex/mirage that implement the change of this PR:

samoht commented 5 years ago

Looks good, merging!