Browse thread
Syntactic inclusion of a.ml in b.ml ?
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | sejourne_kevin <sejourne_kevin@y...> |
| Subject: | Re: [Caml-list] Syntactic inclusion of a.ml in b.ml ? |
Sébastien Hinderer a écrit :
> Dear all,
>
> (How) is it possible to include syntactically a file a.ml in a file
> b.ml ?
>
> One method that seems to w)rk is to rename b.ml to b.ml.c,
> and then have in b.ml.c a line saying
> #include "a.ml"
> And with this, gcc -E b.ml.c > b.ml
> produces a file that ocamlc can apparently handle.
>
> But is this considered a good solution, or is some better solution
> available ?
>
> Many thanks in advance,
> Sébastien.
If you want to use a pre-processor, you can do things like that:
(* ocamlc -pp /lib/cpp test.ml *)
#define P(x) (fst x) (snd x) (fst x)
#define S(x) (snd x)
let x = ("world","hello");;
Printf.printf "%s %s %s %s\n" S(x) P(x);;
or use camlp4
for the use of include :
http://caml.inria.fr/pub/docs/manual-ocaml/manual019.html#@manual.kwd167