caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Olivier Andrieu <andrieu@ijm.jussieu.fr>
To: Olivier Ricordeau <olivier.ricordeau@wanadoo.fr>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] weird compilation problem
Date: Sat, 6 Sep 2003 00:45:04 +0200	[thread overview]
Message-ID: <16217.4592.508630.765966@karryall.dnsalias.org> (raw)
In-Reply-To: <3F5909A7.3060200@wanadoo.fr>

 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 corpus.ml 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
specification.


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.

-- 
   Olivier

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


  reply	other threads:[~2003-09-05 22:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-05 22:09 Olivier Ricordeau
2003-09-05 22:45 ` Olivier Andrieu [this message]
2003-09-06  1:22   ` Olivier Ricordeau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=16217.4592.508630.765966@karryall.dnsalias.org \
    --to=andrieu@ijm.jussieu.fr \
    --cc=caml-list@inria.fr \
    --cc=olivier.ricordeau@wanadoo.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).