From: Gabriel Cardoso <gcardoso.w@gmail.com>
To: Samuel Hornus <samuel.hornus@inria.fr>
Cc: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] Problem with Arg.Tuple
Date: Tue, 13 Mar 2012 13:23:52 +0100 [thread overview]
Message-ID: <CADSDpip9xsADudYkWe_wRVQW98bp3e3L7=+qxQbj1YB=z3vd9g@mail.gmail.com> (raw)
In-Reply-To: <070E17B9-F989-4184-A702-7D323710F52B@inria.fr>
[-- Attachment #1: Type: text/plain, Size: 919 bytes --]
Thanks, I get it now !
Cheers
Gabriel
2012/3/13 Samuel Hornus <samuel.hornus@inria.fr>
>
> On Mar13, 2012, at 11:49 , Gabriel Cardoso wrote:
>
> > 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 !!! *)
>
> Here, the value of !s is empty when the (f !s) is evaluated…
> you shoud pass the whole reference as argument :
> Arg.String(f s)
> and
> let f a b = print_endline !a; print_endline b
>
> > (* Arg.String (fun ss -> f !s ss) (\* Works just fine ... why ? *\)
> *)
>
> why ? because the !s here is evaluated only later, whenthe anonymous
> function is applied.
> --
> Sam
[-- Attachment #2: Type: text/html, Size: 1425 bytes --]
prev parent reply other threads:[~2012-03-13 12:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-13 10:49 Gabriel Cardoso
2012-03-13 11:21 ` Samuel Hornus
[not found] ` <070E17B9-F989-4184-A702-7D323710F52B@inria.fr>
2012-03-13 12:23 ` Gabriel Cardoso [this message]
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='CADSDpip9xsADudYkWe_wRVQW98bp3e3L7=+qxQbj1YB=z3vd9g@mail.gmail.com' \
--to=gcardoso.w@gmail.com \
--cc=caml-list@inria.fr \
--cc=samuel.hornus@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