English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] New Object Creation
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-07-07 (20:13)
From: Gaurav Chanda <gaurav_chanda@l...>
Subject: [Caml-list] New Object Creation

I created 2 files : point.ml and point.mli. The first one contained a simple class definition.

class point =
                value mutable x = 0;
                method addunit v = v+1 ;
The second one contained 

class type point =
                value mutable x : int;
                method addunit : int -> int ;

I used this class in another file, test.ml which contained 

open Point;

value parse t = match t with
  [ "" -> let a = new point in
  |  _ -> ()

My compilation command was: 
ocamlopt -pp "camlp4r pa_extend.cmo" -I +camlp4  -c point.mli point.ml test.ml

However, on compilation I got an error message:

File "t2.ml", line 4, characters 18-27:
Unbound class point
make: *** [code] Error 2

I am not able to create a new point object from outside the file. Could you help me solve this problem ?


Supercharge your e-mail with a 25MB Inbox, POP3 Access, No Ads
and NoTaglines --> LYCOS MAIL PLUS.
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