<pango>
I don't think modules can cross-reference each other
f78 has joined #ocaml
<pango>
for one because they can contain values, and module linking semantics is that module declarations are "evaluated" when the module is linked in
<pango>
there's would be no clear linking order if cross module references were allowed, so it's prohibited
<asbeta>
hmm.. but upto compiling t1.ml there's no problem
<asbeta>
so t1 at this point can reference t2
<pango>
but you can't have both, it's quite clear
<pango>
they're several ways around that, and you suggested one yourself
<asbeta>
probably the problem is that in caml there's now "undefined values", like in haskell
<asbeta>
-w
<pango>
and no problem with using undefined values either, I suppose
<pango>
that said, lazyness probably helps there
<asbeta>
yeah, maybe
_fab has quit [Remote closed the connection]
<pango>
actually, you *can* have recursive modules, if you declare them simultaneously. It's a language extension however, watch out for falling bricks
<pango>
(I annotated you paste)
<pango>
s/you/your/
<asbeta>
but it seems there's no way to do that from shell
Wild_Cat has joined #ocaml
<pango>
seems to interpret just right...
<pango>
module rec T1 : sig type t = T of int val p : t -> t end
<pango>
and T2 : sig val p : T1.t -> T1.t end
<pango>
maybe you forgot to add some last ;; to start evaluation ?
<asbeta>
no, i mean compilation
<asbeta>
i have some kind of logic ast & bunch of operations, and lexer/parser in separate files
<asbeta>
bunch calls parser, parser uses ast, so they "call" each other
<pango>
obviously simultaneous declaration can only happen within a file, so that's not the solution for you
<pango>
I suppose the simplest way out is to declare the AST type(s) separately
<asbeta>
sadly there's no type synonyms
<pango>
not sure what you mean, I don't know Haskell
<asbeta>
i don't really know it either :)
<asbeta>
i meant i'd say something like "typesyn logic = LogicAst.logic;;", so i could substitute LogicAst everywhere
<pango>
just "open LogicAst" should do in your case
<asbeta>
yeah, but the idea was that i do that in some module Logic
<asbeta>
and anyone who open Logic see "logic" type and think it's genuine
<asbeta>
i don't know whether it's mathematically possible or not at this point
<pango>
you could try type logic = LogicAst.logic ... after a quick test, types seem to stay compatible...
<asbeta>
emm.. ehem..
<asbeta>
i tried that my logic.ml and that didn't work at that time. now it works, strange :)
<asbeta>
but logic obtained seem quite abstract
<pango>
mmh that doesn't import the associated constructors, too
<asbeta>
it may be good to have -r option for ocamlc/ocamlopt to instruct compiler to do recursive simultaneous module definition
<smimou>
you can already have recursive module definitions
<pango>
it's experimental however
<pango>
they're constraints, and it's partly resolved at runtime... yuck
<pango>
watch out for "Undefined_recursive_module" exceptions...