is there a way to generate classes along with methods/functions across languages without RPC?

18 views
Skip to first unread message

kant kodali

unread,
Apr 28, 2020, 1:00:39 PM4/28/20
to Cap'n Proto
Hi All,

I was wondering if there is a way to generate classes along with methods across languages without RPC? for example, I do see that capnproto does not have a RPC layer in Java(P.S I code in Java) and few other languages but I would be happy to leverage objects that are generated by capnpro if the code generation can actually generate interfaces, methods along with inheritance across languages without being tied to an RPC server. I can see that you would not normally need this if the purpose is to build a serde framework but that said I could also use if for other purposes besides serde. I thought of this because I see Capnproto can generate interfaces, methods along with inheritance etc but they are tied to some RPC server. so if those two parts can be decoupled that would be great. Please let me know if I am not clear or need to clarify further.

Thanks,
Kant

Kenton Varda

unread,
Apr 29, 2020, 10:58:59 AM4/29/20
to kant kodali, Cap'n Proto
Hi Kant,

Speaking for the C++ implementation (since that's the one I wrote), the generated interface types actually are not tied to a specific RPC implementation. In theory, you could define your own RPC protocol and provide alternatives to rpc.h, rpc.c++, and rpc.capnp. That said, the generated interfaces _do_ assume certain constraints on an RPC system, such as that it can handle object capabilities, promise pipelining, and E-order. Gives the constraints, I am not sure if there is a lot of freedom in the RPC protocol, so I'm not sure an alternative RPC protocol would be interesting. However, it's certainly true that you could implement the code generation for interfaces without having the RPC built out. But, there is still a significant amount of work that goes into generating code at all, and making sure it is designed in a way that is compatible with a future RPC implementation. So, usually people don't embark on that work unless they're also going to implement the RPC protocol.

-Kenton

--
You received this message because you are subscribed to the Google Groups "Cap'n Proto" group.
To unsubscribe from this group and stop receiving emails from it, send an email to capnproto+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/capnproto/201650e8-23d5-46de-9053-a00fce6eaa51%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages