Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
From: Gaurav Chanda <gaurav_chanda@l...>
Subject: [Caml-list] New Object Creation
Hello 

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

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

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

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 ?

Gaurav



_____________________________________________________
Supercharge your e-mail with a 25MB Inbox, POP3 Access, No Ads
and NoTaglines --> LYCOS MAIL PLUS.
http://www.mail.lycos.com/brandPage.shtml?pageId=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