I don't think WASM is likely to be a good fit here, for two reasons: 1) libcapnp and libkj together add up to some 730k of code (text segment) these days. Unless emscripten builds are significantly smaller, that's probably too big. (If you stick to lite mode, it's still 401k, which is still probably too big.)
2) The interface between JS and WASM would probably be very slow if every accessor has to go through it. You'd probably end up wanting to translate the whole capnp to a JSON object upfront, which of course defeats a lot of the purpose. So I definitely think a pure-JS implementation is still desirable. -Kenton On Sat, Apr 8, 2017 at 1:48 PM, Julián Díaz <[email protected]> wrote: > The serialization part is where I fell on my face; I was definitely > following the C++ implementation a bit *too* closely. > > There's a huge amount of type polymorphism needed and that was tripping me > up pretty hard as well; I'm going to instead actually take advantage of the > fact that JS is a dynamic language and that should help cut down on the > amount of code needed. > > WASM is definitely an appealing thought and probably the ideal way to use > capnp in the browser, but the way I see it a pure JS implementation will > continue to be appealing for as long as we have other non-desktop devices > with JS but not WASM support (I'm looking at Android 4.x, especially - > that's going to be around for a while). > > On Saturday, April 8, 2017 at 3:58:26 PM UTC-4, Ross Light wrote: >> >> I have had somebody use GopherJS to read data client side. It works, but >> I can't vouch for how well. >> >> What parts are you having difficulty with representing in JS? Are you >> still on serialization or the RPC part? I found that for Go I would look at >> the C++ implementation to get the spirit of a feature, and then write it >> very differently to fit in with Go. >> >> On Sat, Apr 8, 2017, 10:17 AM Wink Saville <[email protected]> wrote: >> >>> > Of course its very early days for wasm, but I'm following it and just >>>> > beginning to play around with it. >>>> >>>> Worth pointing out, there's also Emscripten, which has been around a >>>> while. So that could be used while wasm support filters into things. >>> >>> >>> Yep, Emscripten is the path I was thinking, it now only output asmjs but >>> also wasm <https://github.com/kripken/emscripten/wiki/WebAssembly>. >>> >>> -- >>> 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 [email protected]. >>> Visit this group at https://groups.google.com/group/capnproto. >>> >> -- > 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 [email protected]. > Visit this group at https://groups.google.com/group/capnproto. > -- 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 [email protected]. Visit this group at https://groups.google.com/group/capnproto.
