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] weird compilation problem
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-09-05 (22:45)
From: Olivier Andrieu <andrieu@i...>
Subject: Re: [Caml-list] weird compilation problem
 Olivier Ricordeau [Saturday 6 September 2003] :
 > Hi!
 > I have a weird compilation problem. ocamlc complains that it doesn't
 > find a class, and I really don't know what mistake I made...
 > FYI, it used to compile fine until I tried to write some interfaces.

 > If someone has an idea of what I did wrong, I'm interested! I'm quite
 > stuck for now.

[ je te l'ai déjà dit mais bon ... ]

You're confusing class specification and class type.

In you define a class, but in corpus.mli you put a class
type. A class type gives a "signature" of a class, listing its methods
and instance variable but a class type doesn't necessarily come with
an implementation (an actual class). So, when you try to use your
Corpus module, you only see a class type and you cannot create an
object with new or define a derived class. What you want is a class

Class definition (in .ml files) :
 class foo = object method bar = some_expr end

Class specification (in .mli files) :
 class foo : object method bar : some_type_expr end

Class type (in .ml and/or .mli files) :
 class type foo = object method bar : some_type_expr end

Also, you do not really need to write a .mli if you're not hiding
anything from the .ml file.


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