Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: "Richard W.M. Jones" <rich@annexia.org>
To: Florian Angeletti <octa@polychoron.fr>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Returning printf from a function
Date: Thu, 23 Aug 2018 10:48:26 +0100	[thread overview]
Message-ID: <20180823094826.xhc253lxxgt5la7a@annexia.org> (raw)
In-Reply-To: <e2c2e011-97f2-084b-c99c-ee26feca7466@polychoron.fr>


Let's complicate this a bit further.  The nearly exact code we are
having problems with is (note that give_fn can return None in the real
code):

----------------------------------------------------------------------
open Printf

let debug fs =
  ksprintf print_endline fs

let give_fn () =
  Some debug

let () =
  let param = "x" in
  debug "single";
  debug "param: %s" param;
  (match give_fn () with
  | None -> ()
  | Some fn ->
    fn "fn";
    fn "fn param: %s" param
  );
  ()
----------------------------------------------------------------------

In this case there's no apparent way to add the extra parameter, I
don't think ...

Rich.

  reply	other threads:[~2018-08-23  9:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-23  9:15 Richard W.M. Jones
2018-08-23  9:28 ` Florian Angeletti
2018-08-23  9:48   ` Richard W.M. Jones [this message]
2018-08-23 10:08     ` Florian Angeletti
2018-08-23 10:23       ` Richard W.M. Jones

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=20180823094826.xhc253lxxgt5la7a@annexia.org \
    --to=rich@annexia.org \
    --cc=caml-list@inria.fr \
    --cc=octa@polychoron.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