Quantcast
Channel: OCaml - Topics tagged dune
Viewing all articles
Browse latest Browse all 521

Maintaining two versions of a module

$
0
0

Say I have a module A that is used throughout my code, and I have two possible implementations of this module, say A1 and A2. (Maybe A1 is more obviously correct, while A2 is more efficient.) By declaring A1 and A2 to implement the same module type and depending only on that signature in the rest of my code, I can guarantee that my code will compile with either implementation.

However, I would also like to regularly compile and test my code with both implementations. I can do this in a kludgy way by copying a1.ml or a2.ml onto a.ml every time I want to switch implementations, but is there a better way? Perhaps involving making them both into libraries or something? The ideal would be to just be able to tell dune which implementation I want to build with each time (or when I want to switch implementations) without having to modify the code.

8 posts - 5 participants

Read full topic


Viewing all articles
Browse latest Browse all 521

Trending Articles