[Libguestfs] [PATCH 0/4]: mllib: Add 'may' function, and refactoring.

Pino Toscano ptoscano at redhat.com
Wed Nov 11 15:02:17 UTC 2015


On Tuesday 10 November 2015 20:39:29 Richard W.M. Jones wrote:
> On Tue, Nov 10, 2015 at 08:25:54PM +0000, Richard W.M. Jones wrote:
> > The 'may' function is a higher-order function (HOF) that replaces:
> > 
> >   match x with
> >   | None -> ()
> >   | Some x -> f x
> > 
> > with:
> > 
> >   may f x
> 
> Another possibility is to break from lablgtk and call the
> function 'maybe', as in:
> 
>   g#set_trace trace;
>   g#set_verbose verbose;
>   maybe g#set_identifier identifier;

I'd personally find slightly more readable 'maybe', but 'may' can also
be OK if it's what is being used also elsewhere (and people can be used
to).

-- 
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20151111/6986cb05/attachment.sig>


More information about the Libguestfs mailing list