[Libguestfs] [PATCH common 2/4] mltools: Reimplement On_exit to use a list of actions
Laszlo Ersek
lersek at redhat.com
Fri Jul 15 08:25:29 UTC 2022
On 07/15/22 10:12, Richard W.M. Jones wrote:
> On Fri, Jul 15, 2022 at 09:12:24AM +0200, Laszlo Ersek wrote:
>>> +let do_action action =
>>> + try
>>> + match action with
>>> + | Unlink file -> Unix.unlink file
>>> + | Rm_rf dir ->
>>> + let cmd = sprintf "rm -rf %s" (Filename.quote dir) in
> ...
>>
>> (2) Shouldn't we use two spaces for indentation here, relative to "R"?
>
> Possibly, but this is what emacs tuareg-mode gives me.
>
> I guess we need to get more serious about OCaml formatting at some
> point which may require fixing tuareg-mode too since it's quite
> erratic sometimes.
Right, I'm happy to adopt any particular guidelines; currently I'm
sometimes just disoriented and looking for ideas how to format a
particular construct I want to do. Especially because functions are
first class citizens and can be passed around as arguments, formatting
can become tricky. And "turn it into a named function" is not the right
answer; it takes away quite a but of OCaml's power -- we *want* to be
able to open-code function arguments to List.iter, List.map,
List.filter, and so on!
Laszlo
More information about the Libguestfs
mailing list