1. 41

  2. 11

    Author here! Happy to answer any questions.

    1. 4

      capnproto looks great, but also seems quite complicated internally on the RPC side. Do you think this hurts adoption in languages that are not C++? I know of a few reimplementations (in OCaml and rust) but it seems hard to reach level 3 or 4 of compatibility. Will 1.0 come with some RFCs or attempts to have a set of robust compatible implementations?

      1. 7

        I do think that’s a big problem, yes. The Cap’n Proto RPC design calls for a fairly complicated implementation in order to make life easy for the application developer. The new streaming stuff in particular managed to tickle a bunch of subtle message-ordering bugs inside even the C++ implementation. (Message ordering obviously matters a lot for streaming.)

        I’ve been thinking lately about how hard it would be to make the C++ RPC implementation reusable from other languages, so that the logic doesn’t need to be re-implemented. Interestingly, the API surface of the RPC layer is actually pretty small (this differs from the serialization layer, which has a wide API surface but very little implementation complexity). So I wonder if per-language serialization implementations can easily be paired with the C++ RPC state machine.

        Cap’n Proto serialization is actually rather ideally designed for exactly this, since the whole point of the zero-copy design is that messages in-memory are backed by a common memory layout. Sharing byte buffers between languages is pretty easy.

        Of course, I recognize that implementation heterogeneity is not a good thing in general. But I think it’s better than not having RPC implementations at all in most languages.

        1. 2

          I’d say you need to expose a C-compatible API, which is much easier to bind than C++ from most languages, and perhaps separate the project more explicitly from the codegen for C++ (which, after all, would just be one of the consumers of this common messaging API).

        2. 3

          I’d personally like to see some RFCs from something like this. It’s driven me to choose certain technologies over others in the past (ie. CBOR over MessagePack), and IMO it can help with diversifying implementation.

        3. 1

          I’ve implemented http-over-protobuf before and couldn’t find a nice reference implementation to emulate at the time. Was nice to read through the http-over-rpc capnproto schema and see all the features, corner cases, and optimizations I missed.