Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Legality of using module types from .mli in .ml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Julien Signoles <Julien.Signoles@l...>
Subject: [Caml-list] Re: Legality of using module types from .mli in .ml
Thorsten Ohl wrote:
> 
> I'm often referring to module types defined in an interface file in
> order to reduce redundancy.  For example
> 
>     $ cat a.mli
>     module type T = sig val n : int end
>     module M : T
> 
>     $ cat a.ml
>     module type T = A.T
>     module M : T = struct let n = 42 end
> 
> where T can be rather long.  Is this legal?

For me, your module type declaration should be illegal in a.ml. But the
ocaml compiler accepts it... 
So, is it an ocaml bug ? Orelse what is the exact semantic of (.mli,
.ml) ?
 
> The reason I'm asking this, is that my shorthand [as in (a.mli, aml)]
> breaks Julien Signoles' defunctorizer.

The previous example doesn't break my defunctorizer :

	$ ocamldefun --version
	1.02
	$ ocamldefun a.mli a.ml
	$ cat a.ml
	module type T = A.T
	module M = struct let n = 42 end

That's ok (normal because a.mli is still in the ocamldefun environment
when a.ml is defunctorized)...
Can you report me your example breaking my defunctorizer ?

Cheers,
Julien Signoles.

-- 
mailto : Julien.Signoles@lri.fr ; http : www.lri.fr/~signoles
"In theory, practice and theory are the same, 
but in practice they are different" (Larry McVoy)
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners