Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This would be the first place I'd look if I were the Mozilla guys.


why not cap'n'proto?


Cap'n Proto's Time Traveling RPC[0] would indeed be a perfect match for the IoT.

[0] https://capnproto.org/news/2013-12-12-capnproto-0.4-time-tra...


In theory it’s nice, but the core cap’n’proto library is too large for many embedded devices. It seems to be full of dynamic features making it difficult to pair down.


Have you tried using link-time garbage collection? The library is designed in a layered way, such that the core serialization does not depend on the "dynamic" features, so if you don't ever call "dynamic" features then link-time GC should be able to drop a huge chunk of the lib.

There's also "lite mode", which #ifdef's out all the dynamic stuff:

    ./configure --disable-reflection
Although it isn't as aggressive as it could be. We should fix that. I filed an issue:

https://github.com/capnproto/capnproto/issues/634

There is also a C implementation of capnp which I believe is designed for small footprint, FWIW.


No I didn’t but that’s good to know. I tried a few attempts but wasn’t sure about how integral the reflection portions were (or if exceptions were crucial). I’d likely just compiled the library on my dev machine and looked at the library size and tried a few flags to get a quick idea if it’d work.

It’d be useful to be able to just use the serialization protocol. Currently I’m using MsgPack which works decently well to get data from embedded cores but I’d prefer typed structures. Thanks for the feedback!


> or if exceptions were crucial

Although KJ style prefers exceptions, the library is carefully written (and tested) to work with -fno-exceptions. KJ_ASSERT/KJ_REQUIRE invocations (which normally throw exceptions) can define a fallback path to use in the case that exceptions are disabled, usually involving returning some sort of dummy value. You can also register a per-thread exception callback which will be called on all exceptions before the fallback starts (or before aborting, if there is no fallback).


That’s excellent! That certainly makes it seem much more useful for many embedded environments.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: