From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: ** X-Spam-Status: No, score=2.0 required=5.0 tests=AWL,DNS_FROM_RFC_POST, HTML_MESSAGE,SPF_NEUTRAL autolearn=disabled version=3.1.3 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 10477BBAF for ; Tue, 16 Jun 2009 23:12:36 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApgDAH+nN0rRVdrPmGdsb2JhbACCITGVQT8BAQEBAQgJDAcTqx+BF49oAQMCBIQHBQ X-IronPort-AV: E=Sophos;i="4.42,232,1243807200"; d="scan'208";a="31389267" Received: from mail-bw0-f207.google.com ([209.85.218.207]) by mail1-smtp-roc.national.inria.fr with ESMTP; 16 Jun 2009 23:12:35 +0200 Received: by bwz3 with SMTP id 3so4506799bwz.27 for ; Tue, 16 Jun 2009 14:12:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=8LlsgODcRl3EpgCSpwQ5i00dlhiKWQU2Ps9enjyqoT0=; b=MalvuS+zstDKbEXuUjJTxOVAM34HMTXFMauRKgqYBwMh3O3bZIK2WGOS4ag23L+8ra 9V8ApWvkyaD0EXaWfAyq74J+PdioKLkj/F3hULIhiCHgVDDUoxt0qHA4PLt8tDRMdHI9 FSsEECsbSJYzS1Tylzlxv3NIprxrkLFZB5ycA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=EZIHezcJTh78xRPklgzTKD+T/5yPJa4Yi2om0+sU6SStSvR2KooYnqhwMvnclRmgMt ODiBrD3fbHRa4926Ke/VNm0uLVWh+ary8hmXfo4VG4hr9JMBQYu0sxPsXToqQaam6qms geGQrRItwciiL2bH9k7nSZdIVfNlAaaN+y1Qg= MIME-Version: 1.0 Received: by 10.216.8.65 with SMTP id 43mr2940081weq.168.1245186755219; Tue, 16 Jun 2009 14:12:35 -0700 (PDT) Date: Tue, 16 Jun 2009 17:12:35 -0400 Message-ID: Subject: default arguments in classes From: Jacques Le Normand To: caml-list caml-list Content-Type: multipart/alternative; boundary=0016364c7a1d3959e5046c7da239 X-Spam: no; 0.00; foo:01 baz:01 foo:01 baz:01 cheers:01 cheers:01 incompatible:01 incompatible:01 define:02 define:02 expression:02 expression:02 argument:02 argument:02 string:02 --0016364c7a1d3959e5046c7da239 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hello list, I'm trying to define a method with a default argument, but I keep getting an error. Here's the code: class foo = object (self) method bar ?(baz="moo") () = (new foo)#bar ~baz () end and the error: The expression "new foo" has type foo but is used with type < bar : baz:string -> unit -> 'a; .. > Types for method bar are incompatible how do I fix this? cheers --Jacques L. --0016364c7a1d3959e5046c7da239 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hello list,
I'm trying to define a method with a default argument, b= ut I keep getting an error. Here's the code:

class foo=A0 =3D=A0 object (self)
=A0=A0=A0 method bar ?(baz=3D"moo") () =3D<= br>=A0=A0=A0 (new foo)#bar ~baz ()
=A0 end

and the error:

The expression "new foo" has= type foo but is used with type
=A0 < bar : baz:string -> unit -&g= t; 'a; .. >
Types for method bar are incompatible

how do I= fix this?
cheers
--Jacques L.
--0016364c7a1d3959e5046c7da239--