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

-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to