Version française
Home     About     Download     Resources     Contact us    
Browse thread
Arg.spec and option types
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Nicolas Pouillard <nicolas.pouillard@g...>
Subject: Re: [Caml-list] Re: Arg.spec and option types
On 3/22/07, Sam Steingold <sds@gnu.org> wrote:
> Nicolas barnier wrote:
> >
> > I think it would therefore be quite useful to add
> > Set_option_{string|int|float}
> > constructors which would expect {string|int|float} option ref values as
> > arguments (usually initialized with None). Do others think the same or use
> > some other workaround to obtain this behaviour ?
>
> It is nice to know that I am not the only one who is writing
>   Arg.String (fun s -> foo := Some s)
> all the time.
>
> Sam.
>

What about,

let opt_str r = Arg.String (fun s -> r := Some s);;

... opt_str foo ...

That's what I use all the time.

-- 
Nicolas Pouillard