English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Including code from a .cm[ox] into another .cm[ox]
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2009-11-12 (12:16)
From: Guillaume Yziquel <guillaume.yziquel@c...>
Subject: Including code from a .cm[ox] into another .cm[ox]

Imagine I have a file named a.ml containing

> module C = struct
>   include B
> end

and a file named b.ml containing the code

> let f x = x + 1

When I compile everything to .cmo files, I cannot load a.cmo from the 
toplevel without loading b.cmo beforehand.

Is there a way to make the 'include B' statement to include the code of 
the B module in the C submodule directly so that it is not required to 
load the b.cmo file before loading the a.cmo file?

That would be extremely useful to me...

All the best,

      Guillaume Yziquel