caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Adrien <camaradetux@gmail.com>
To: Caml Mailing List <caml-list@yquem.inria.fr>
Subject: [Caml-list] Optional arguments "between" non-optional ones
Date: Thu, 23 Sep 2010 15:20:59 +0200	[thread overview]
Message-ID: <AANLkTi=G6xG6b56FZsT9=n26y9f0Tzpk-3g+_P0sLo1h@mail.gmail.com> (raw)

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


             reply	other threads:[~2010-09-23 13:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-23 13:20 Adrien [this message]
2010-09-23 14:32 ` bluestorm
2010-09-23 15:05   ` Adrien
2010-09-24  1:32     ` Jacques Garrigue

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AANLkTi=G6xG6b56FZsT9=n26y9f0Tzpk-3g+_P0sLo1h@mail.gmail.com' \
    --to=camaradetux@gmail.com \
    --cc=caml-list@yquem.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).