I defined to following code, using recursive modules as you described,
but I got the same error:
module type Algorithm =
sig
val run_algorithm : unit -> unit
end
module Framework =
functor (Alg : Algorithm) ->
struct
let print_benchmark_results () = print_endline "Excelent!"
end
module rec FooAlgorithm : Algorithm =
struct
let run_algorithm () = ()
let results () = BenchmarkFoo.print_benchmark_results ()
end
module BenchmarkFoo = Framework(FooAlgorithm)
------------------------------------
File "test.ml", line 15, characters 19-55:
Unbound value BenchmarkFoo.print_benchmark_results
make[1]: *** [test.cmi] Error 2
--- In ocaml_beginners%40yahoogroups.com">ocaml_beginners
yahoogroups.com, Virgile Prevosto
<virgile.prevosto
...> wrote:
>
> Hello,
>
> Le jeu 07 déc 2006 23:41:12 CET,
> "drehman27" <drehman27
...> a écrit :
>
> > module Framework =
> > functor (Alg : Algorithm) ->
> > struct
> > let f x = ...
> > ...
> > end
>
> > module FooAlgorithm : Algorithm =
> > struct
> > ...
> > Framework.f ... ------------> error
> > end
> >
> > module BenchmarkFoo = Framework(FooAlgorithm)
> >
>
> you may want to use recursive modules, an experimental feature of the
> language described in section 7.9 of the manual. In your case, you
> would define FooAlgorithm and BenchmarkFoo like this:
>
> module rec FooAlgorithm: Algorithm =
> struct
> ... BenchmarkFoo.f ...
> end
> and BenchmarkFoo = Framework(FooAlgorithm)
>
> Note however that this is not the most stable feature of Ocaml, and
> that there are some restrictions on the modules you can define that way.
> --
> E tutto per oggi, a la prossima volta.
> Virgile
>
.