Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] quasi newbie question concerning modules presentatiion in the online O'Reilly book
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Remi Vanicat <remi.vanicat@l...>
Subject: Re: [Caml-list] quasi newbie question concerning modules presentatiion in the online O'Reilly book
Vasili Galchin <vasiliocaml@yahoo.com> writes:

> Hello,
>
>     I have been playing with the stack.mli plus
> stack.ml implementation that respresents a stack as an
> array. If I   package as "module" sig and struct as
> presented in
> http://caml.inria.fr/oreilly-book/html/book-ora131.html#toc183
>
> When I compile stack.mli and stack.ml as specified
> here, I get an error complaining that the
> implementation doesn't match the interface and also
> missing a STACK field. If I comment all MODULE syntax
> at the beginning and end of stack.mli and stack.ml,
> then this stack compiles cleanly. Why?

I believe you have wrote 
stack.mli :
module type STACK =
sig 
...
end

and
stack.ml :
module Stack =
struct
...
end

when you should have wrote
stack.mli :
...

stack.ml :
...

ocaml already know that a mli is a signature, and a ml is a module.

by the way, there is already a stack module in the ocaml standard
library, maybe you could use it, or at least name yours differently.

-- 
Rémi Vanicat

-------------------
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