Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] newbie problem with splitting code into files
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-05-23 (12:51)
From: g.o.d@z...
Subject: [Caml-list] newbie problem with splitting code into files

i am a bloody ocaml newbie. i have big problems with learning
ocaml as my brain refuses to thing functional... is get better slowly.

i studied several documentation sources but i was not able to find
a solution for the following problem:

i want to split code like for example the following into
several files:

-------------------- 8< --------------------
class type test_type = object
	val mutable x:int
	method get_x:int

class test : test_type = object
	val mutable x = 0
	method get_x = x

let main() =
	let t=new test in
	printf "X: %d\n" t#get_x;;

let _ = main()

-------------------- 8< --------------------

as long as i keep this in one file it works.
so what i did now is splitting it up, putting
class type declaration into test.mli, putting
class declaration into and putting
let main()... into

when i now compile test.mli followed by,
i get error messages like:

The implementation does not match the interface test.cmi:
The field `#test_type' is required but not provided
The field `test_type' is required but not provided

So what am i doing wrong?

thank you
-> Heiko Irrgang

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: