[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Libguestfs] [PATCH v2 2/2] v2v: use Getopt.Symbol for few options



On Tue, Jul 19, 2016 at 02:28:31PM +0200, Pino Toscano wrote:
> Use Getopt.Symbol for options with a fixed list of choices, so there is
> no need to check them on our own.

It would sure be nice if Getopt.Symbol was smarter and could do the
full conversion from string to internal type safely.  That would
remove the need to have the type unsafe cases like:

> +    | _ -> assert false (* Already checked by Getopt.Symbol. *)

This would be trivial with a camlp4 or ppx macro.  Since we don't want
to add those packages as dependencies, how about generating code (in
the generator) to do that?

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]