On Tue, Sep 06, 2022 at 04:19:40AM -0500, Eric Blake wrote:
> > > +  assert (cr3 = (Int64.add cr2 fudge))
> 
> Not so in OCaml, where + isn't even polymorphic to int64, so I have to
> break out manual calls to Int64.XXX methods.  Here, I went with a
> helper variable 'fudge'.

No implicit type conversions in OCaml! (as a deliberate choice)

You don't need to the parens around Int64.add since function
application always binds tightest.

You could have written this if you'd wanted:

  let (+^) = Int64.add
  ...
  assert (cr3 = cr2 +^ fudge)

Custom operators always have the same precedence as the normal
operator with the same first character.

Or in recent OCaml versions:

  assert Int64.(cr3 = cr2 + fudge)

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW
_______________________________________________
Libguestfs mailing list
Libguestfs@redhat.com
https://listman.redhat.com/mailman/listinfo/libguestfs

Reply via email to