From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id VAA02956 for caml-red; Wed, 20 Sep 2000 21:52:49 +0200 (MET DST) 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 MAA31391 for ; Wed, 20 Sep 2000 12:42:03 +0200 (MET DST) Received: from mail.caspur.it (mail.caspur.it [193.204.5.82]) by concorde.inria.fr (8.10.0/8.10.0) with ESMTP id e8KAg2v16661 for ; Wed, 20 Sep 2000 12:42:02 +0200 (MET DST) Received: from dia.uniroma3.it (remote-28.caspur.it [193.204.5.230]) by mail.caspur.it (8.11.0/8.11.0) with ESMTP id e8KAg1F01250; Wed, 20 Sep 2000 12:42:01 +0200 Message-ID: <39C8938F.8DFC8039@dia.uniroma3.it> Date: Wed, 20 Sep 2000 12:38:07 +0200 From: "Dr. Wolfgang Gehrke" Organization: DIA Uni Roma III X-Mailer: Mozilla 4.75 [en] (X11; U; Linux 2.2.14-SMP i686) X-Accept-Language: en, de MIME-Version: 1.0 To: caml-list@inria.fr Subject: problem with optional arguments Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: weis@pauillac.inria.fr Hello, could someone advice me how to resolve the following problem: The following works fine: class test1 ~(a:int) () = object val a = abs a method a = a method strange x = new test1 ~a:x () end let t1 = new test1 ~a:(-10) () But on the other hand with an optional argument it does not compile, neither: class test2 ?(a:int) () = object val a = abs a method a = a method strange x = new test2 ~a:x () end nor in the form below: class test3 ?(a:int) () = object val a = abs a method a = a method strange x = new test3 ?a:x () end I do need the use of "new" and do not want to use {<...>} since any new instance internally changes a. Thank you, Wolfgang