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 VAA19873; Wed, 28 Apr 2004 21:43:33 +0200 (MET DST) 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 VAA19862 for ; Wed, 28 Apr 2004 21:43:32 +0200 (MET DST) Received: from gatekeeper.elmer.external.excelhustler.com (gatekeeper.excelhustler.com [68.99.114.105]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i3SJhVYM020290 for ; Wed, 28 Apr 2004 21:43:31 +0200 Received: from chatterbox.elmer.internal.excelhustler.com (unknown [192.168.0.12]) (using TLSv1 with cipher EDH-RSA-DES-CBC3-SHA (168/168 bits)) (Client CN "chatterbox.elmer.internal.excelhustler.com", Issuer "excelhustler.com" (not verified)) by gatekeeper.elmer.external.excelhustler.com (Postfix) with ESMTP id BF028E022D; Wed, 28 Apr 2004 14:43:30 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by chatterbox.elmer.internal.excelhustler.com (Postfix) with ESMTP id 892125C006; Wed, 28 Apr 2004 14:43:30 -0500 (CDT) Received: from wile.internal.excelhustler.com (wile.internal.excelhustler.com [192.168.1.34]) by chatterbox.elmer.internal.excelhustler.com (Postfix) with ESMTP id 7131F5C005; Wed, 28 Apr 2004 14:43:30 -0500 (CDT) Received: by wile.internal.excelhustler.com (Postfix, from userid 1000) id 611313D00F; Wed, 28 Apr 2004 14:43:30 -0500 (CDT) Date: Wed, 28 Apr 2004 14:43:30 -0500 From: John Goerzen To: james woodyatt Cc: caml-list@inria.fr Subject: Re: [Caml-list] Optional arguments in inherited methods Message-ID: <20040428194330.GB7949@excelhustler.com> References: <20040428161336.GA3286@excelhustler.com> <02C591A1-9935-11D8-BD03-000A958FF2FE@wetware.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <02C591A1-9935-11D8-BD03-000A958FF2FE@wetware.com> User-Agent: Mutt/1.5.5.1+cvs20040105i X-Scanned-By: clamscan at chatterbox.elmer.internal.excelhustler.com X-Miltered: at concorde by Joe's j-chkmail ("http://j-chkmail.ensmp.fr")! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 2004:99 woodyatt:01 mli:01 superclass:01 hashtbl:01 class's:01 hashtbl:01 argh:01 ocaml's:01 compiler:01 compiler:01 bool:01 bool:01 0700,:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Wed, Apr 28, 2004 at 09:56:36AM -0700, james woodyatt wrote: > method getdataf sname =3D >=20 > ...you wish the compiler to insure that the default values are used for= =20 > each of the optional arguments in the [possibly partial] evaluation of=20 > the derived class method. >=20 > Well?=A0it doesn't. You have to define the derived class method in two= =20 > parts. Hmm. I worked around that problem but now I have a new one. From my =2Emli file, I have this in my superclass: method get: ?default:string -> string -> string -> string and I wish to have this in my subclass: method get: ?default:string -> ?raw:bool -> ?idepth:int ->=20 ?extravars:(string, string) Hashtbl.t=20 -> string -> string -> string =20 Now, since labeled args are not positional, I would think that the compiler should have no problem with adding new optional args, since a call to the base class's method would remain completely valid as a call to the subclass's method. However, I get this error: The method get has type ?default:string -> ?raw:bool -> ?idepth:int -> ?extravars:(string, string) Hashtbl.t -> string -> string -> string but is expected to have type ?default:string -> string -> string -> string Argh. Does OCaml's object system really not support adding additional optional variables to subclass methods? That would be rather annoying if true. -- John ------------------- 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