[Libguestfs] [PATCH 2/5] v2v/lib/util.ml: Get disk allocation from input

Richard W.M. Jones rjones at redhat.com
Mon Dec 20 12:36:50 UTC 2021


I mean, I don't like functions with lots of parameters either (and
this function does have a lot already).  But at least with strong
typing + labels it's harder to mix them up.

An alternative is to put the parameters into a struct and pass them
that way.  That's essentially what I did with the Input/Output/Convert
"options" structs.  A disadvantage of this is it's less clear when a
parameter is no longer being used because the compiler can't warn you
about it (-w +20 [ignored-extra-argument] Unused function argument.)

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/




More information about the Libguestfs mailing list