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 SAA08384; Wed, 28 Apr 2004 18:56:44 +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 SAA08372 for ; Wed, 28 Apr 2004 18:56:42 +0200 (MET DST) X-SPAM-Warning: Sending machine is listed in blackholes.five-ten-sg.com Received: from wetware.com (wetware.wetware.com [199.108.16.1]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i3SGucYM029292 for ; Wed, 28 Apr 2004 18:56:41 +0200 Received: from [208.177.152.17] (helo=[10.0.1.5]) by wetware.com with esmtp (Exim 4.20) id 1BIsMP-0006JG-Re; Wed, 28 Apr 2004 09:56:38 -0700 In-Reply-To: <20040428161336.GA3286@excelhustler.com> References: <20040428161336.GA3286@excelhustler.com> Mime-Version: 1.0 (Apple Message framework v613) Content-Type: text/plain; charset=WINDOWS-1252; format=flowed Message-Id: <02C591A1-9935-11D8-BD03-000A958FF2FE@wetware.com> Content-Transfer-Encoding: quoted-printable Cc: caml-list@inria.fr From: james woodyatt Subject: Re: [Caml-list] Optional arguments in inherited methods Date: Wed, 28 Apr 2004 09:56:36 -0700 To: John Goerzen X-Mailer: Apple Mail (2.613) 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; woodyatt:01 jhw:01 wetware:01 caml-list:01 inferring:01 annoyances:01 inferring:01 woodyatt:01 jhw:01 wetware:01 village:99 compiler:01 compiler:01 subclass:02 string:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On 28 Apr 2004, at 09:13, John Goerzen wrote: > > I have this defined in a base class: > > method private getdata sname oname =3D > > In my subclass, I wish to do this: > > method private getdata ?(raw=3Dfalse) ?(idepth=3D10) ?extravars = sname=20 > oname =3D > > The compiler does not seem to like this at all, though I am at a loss=20= > to > explain why. Can someone help me out? Presumably, given this in the base class: method getdataf sname =3D ...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. Well=97=A0it doesn't. You have to define the derived class method in = two=20 parts. method private getdata_aux ?(raw=3Dfalse) ?(idepth=3D10) = ?extravars sname=20 oname =3D method private getdata sname oname =3D self#getdata sname oname > The error I get is: > > The method getdata has type > ?raw:'a -> ?idepth:'b -> ?extravars:'c -> 'd -> 'e -> 'f > but is expected to have type string -> string -> string > > So even stranger is that it doesn't set a type for anything, even=20 > though > it has enough information to figure out the type for everything. Yeah, it's already decided you have a problem before it's finished=20 inferring the types of everything. That might be another one of those=20= little annoyances... since inferring types when the code is known to be=20= in error is probably a hard problem. --=20 j h woodyatt that's my village calling... no doubt, they want their idiot back. ------------------- 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