From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id BAA12569; Wed, 21 Mar 2001 01:06:37 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id BAA11446 for ; Wed, 21 Mar 2001 01:06:36 +0100 (MET) Received: from kurims.kurims.kyoto-u.ac.jp (kurims.kurims.kyoto-u.ac.jp [130.54.16.1]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f2L06XX18692 for ; Wed, 21 Mar 2001 01:06:34 +0100 (MET) Received: from localhost (mikan.kurims.kyoto-u.ac.jp [130.54.16.202]) by kurims.kurims.kyoto-u.ac.jp (8.9.3/3.7W) with ESMTP id JAA17626; Wed, 21 Mar 2001 09:06:22 +0900 (JST) To: wester@ilt.fhg.de Cc: caml-list@inria.fr Subject: Re: [Caml-list] classes and labels In-Reply-To: <200103201502.QAA27766@ilt.fhg.de> References: <200103201502.QAA27766@ilt.fhg.de> X-Mailer: Mew version 1.94.2 on Emacs 20.7 / Mule 4.0 (HANANOEN) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <20010321090622X.garrigue@kurims.kyoto-u.ac.jp> Date: Wed, 21 Mar 2001 09:06:22 +0900 From: Jacques Garrigue X-Dispatcher: imput version 20000228(IM140) Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk From: wester@ilt.fhg.de > class myclass ?(n=0) () = > object > val nn = n; > method get_nn = nn > method clone (na: int) = let (mc: myclass) = new myclass ~n:na () in mc; > end;; > > that produces the following error message in the toplevel: > > Characters 5-153: > The expression "new myclass" has type ?n:int -> unit -> myclass > but is used with type int -> unit -> myclass What version of ocaml are you using ? At least, I couldn't reproduce the problem with 3.01: Objective Caml version 3.01 # class myclass ?(n=0) () = object val nn = n; method get_nn = nn method clone (na: int) = let (mc: myclass) = new myclass ~n:na () in mc; end;; class myclass : ?n:int -> unit -> object val nn : int method clone : int -> myclass method get_nn : int end And this both with the -labels option on and off. By the way, you don't need all these annotations in the clone method: method clone na = new myclass ~n:na () Regards, Jacques Garrigue ------------------- To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr