From: Gabriel Cardoso <gcardoso.w@gmail.com>
To: caml-list@inria.fr
Subject: [Caml-list] Problem with Arg.Tuple
Date: Tue, 13 Mar 2012 11:49:10 +0100 [thread overview]
Message-ID: <CADSDpiofjUCP_K3n6XHqHR02UcXCLooKNgsG6fKsqEvyZUfJsg@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 705 bytes --]
Dear list,
I have empty arguments when using Arg.Tuple with references. This
minimalist example illustrates my problem :
let f a b =
print_endline a;
print_endline b
let s = ref ""
let speclist = [(
"-a",
Arg.Tuple [
Arg.Set_string s;
Arg.String (f !s) (* !s is empty !!! *)
(* Arg.String (fun ss -> f !s ss) (\* Works just fine ... why ? *\) *)
],
"doc"
)]
let _ = Arg.parse speclist (fun s -> ()) "usage"
--------------------
$ ocamlc test.ml
$ /a.out -a x y
y
------------------------
When uncommenting the line 12 :
------------------------
$ ocamlc test.ml
$ ./a.out -a x y
x
y
-------------------------
Any idea what am I doing wrong ?
Thanks in advance !
Gabriel
[-- Attachment #2: Type: text/html, Size: 1301 bytes --]
next reply other threads:[~2012-03-13 10:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-13 10:49 Gabriel Cardoso [this message]
2012-03-13 11:21 ` Samuel Hornus
[not found] ` <070E17B9-F989-4184-A702-7D323710F52B@inria.fr>
2012-03-13 12:23 ` Gabriel Cardoso
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=CADSDpiofjUCP_K3n6XHqHR02UcXCLooKNgsG6fKsqEvyZUfJsg@mail.gmail.com \
--to=gcardoso.w@gmail.com \
--cc=caml-list@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