From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id CA89EBC57 for ; Thu, 23 Sep 2010 15:21:01 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: As0BAKLwmkzRVdW0kWdsb2JhbACiKAgVAQEBAQkLCgcRAx+pWYk9ghSGSS6IVQEBAwWFPASKOA X-IronPort-AV: E=Sophos;i="4.57,223,1283724000"; d="scan'208";a="58993135" Received: from mail-yx0-f180.google.com ([209.85.213.180]) by mail3-smtp-sop.national.inria.fr with ESMTP; 23 Sep 2010 15:21:01 +0200 Received: by yxi11 with SMTP id 11so709953yxi.39 for ; Thu, 23 Sep 2010 06:21:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=gxRbrxJPaPXRRTxZmQhEuiNH49hdGDdgoBXwdFSV2nI=; b=vqLjql95xUVTaDSMc0t1FyFvmjArz5C4C1r5/B/gyLRYKZAQb/5tiQj4lWeIJj15Ys QZalaldnOzbP56CDwtmYbkaOvegJtptgWy8qFuF2oFz3ASpAfBOTz6LI82bW9aowzc5J o0Srbild/0rDBlh+8bN2BQvI4Sx9hTSifuQWk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=TRigfVeY7u7iGAqFLSqvi9K0wXyPCGOJetfRjRHQL2iOmycCrWxt0sS7EV00vBIkf5 IPZ4GCs465snnFKJGX1SYuuZuKpvE9BnAabm3IC9Tnu4yydEjpXpchVjKMMd90lJsxoO SL129xrI7WdCdFa5bks7AIy9UhdD7TL7BCY3M= MIME-Version: 1.0 Received: by 10.220.62.202 with SMTP id y10mr767719vch.198.1285248059242; Thu, 23 Sep 2010 06:20:59 -0700 (PDT) Received: by 10.220.41.203 with HTTP; Thu, 23 Sep 2010 06:20:59 -0700 (PDT) Date: Thu, 23 Sep 2010 15:20:59 +0200 Message-ID: Subject: [Caml-list] Optional arguments "between" non-optional ones From: Adrien To: Caml Mailing List Content-Type: text/plain; charset=ISO-8859-1 X-Spam: no; 0.00; endline:01 typing:01 caml-list:01 expression:02 expression:02 argument:02 seems:03 unit:03 unit:03 let:03 let:03 nader:05 explanation:06 arguments:07 optional:09 Hi, I was refactoring code today and hit a typing error that I couldn't explain. I eventually tracked it down to the following: let f () ?a () = print_endline "bouh!" let h f = f () () let () = h f;; (* error is for "f" here *) Error: This expression has type unit -> ?a:'a -> unit -> unit but an expression was expected of type unit -> unit -> 'b If I remove the first unit argument of f, then it works as expected. There also seems to be variations around that. Is there any explanation for that difference? And any chance of it getting improved? Thanks. -- Adrien Nader