2 ms·
I love OCaml as well, but haven't seen this before. It's interesting that libguestfs provides both object and module style interface and virt-builder seems to b
by strlen 13y ago
I love OCaml as well, but haven't seen this before. It's interesting that libguestfs provides both object and module style interface and virt-builder seems to be using the object style:
http://libguestfs.org/guestfs-ocaml.3.html http://libguestfs.org/guestfs-ocaml.3.html
Overall, great article and great code. Let's keep in mind that SML is typically taught to entry-level CS students (some of them with no programming experience) at universities like CMU, where often a term project might actually be an ML compiler in ML. It's not a terribly complex language and some limitations (which I am not going to state here) aside it has a great use to play.
It should be noted that XenServer also uses OCaml. While it's not really fair to compare Go with OCaml (the language roots are vastly different as are the philosophies -- aside from the idea that "static typing shouldn't mean typing so much you generate static electricity") both seem to do best in the "userland systems programming" niche -- that awkward place where C++ is needlessly painful, Java is ill-fitted, and python/etc... simply inappropriate.
- rwmj 13y agoThe guestfs API and bindings in all the languages are generated -- by a large OCaml program. https://github.com/libguestfs/libguestfs/tree/master/generator https://github.com/libguestfs/libguestfs/tree/master/generat... For an API that has 400 or so calls accessible through a dozen different programming languages, this makes sense. The bindings in each language are never out of date or wrong (except of course they can have a systematic bug, but those are much easier to fix). This also makes it very easy to generate alternate "views" of the same API, like OCaml module vs OO views.