Wow, great job. Congrats! I have a compile-to-JS project (unfortunately it uses BuckleScript because genType is incredibly useful) and when I reviewed the protobuf story I decided to go with protobufjs. Now ocaml-protoc-plugin looks incredible. One question I have is if you are open to stripping the runtime dependencies. It currently uses Base and ocplib-endian and a few ppxs. All of these are rather cumbersome to bring to the bucklescript-world. Or maybe a better way is to use a separate runtime for BuckleScript altogether?
OCaml-Protoc uses its own parser which chokes on “service” lines and some set of other smaller syntactic details (also does not support imports very well). It depends on ppx_deriving_protobuf which at last time I checked didn’t support OCaml 4.07+. In addition the code it generates puts records with same keys into the same module thus confusing OCaml’s inference to the point where you have to force the “proper” type on every let statement which makes the code read somewhat like C.
In addition the runtime is very imperative in nature, where you have to serialize and deserialize types through an somewhat ugly “Builder”-kind of API.
Protobuf is more than just a message format for serialization and deserialization. It allows you to define backward and forward compatible messages, as all fields in a message is explicitly tagged. Also the definition of messages for protobuf resides in a .proto file, which allows you to generate serialization and deserialization function for other languages that ocaml.
The library is not yet optimized for speed - but I gather it will never compete with native ocaml mashalling - Its definitely safer, as it will never segfault.