TazeTSchnitzel 3 days ago

I don't know about Swift, but in Objective-C, couldn't you use something like NSKeyedArchiver for serializing a complex object graph to a byte string? It's not safe if you don't trust the input, but if you do, I'm not sure why you'd go to the effort of reinventing this particular wheel, besides it being fun. Though maybe the serialization and deserialization are not the interesting parts here.

  • Bogdanp 3 days ago

    That still leaves you with the problem of wiring up the request -> response types manually, doesn't it? The serialization format isn't that important in this case.

    • TazeTSchnitzel 3 days ago

      Oh, I see, so the value of the DSL is in handling the pair of request and response. I suppose that makes sense.

      There is probably a way you could accomplish this with generically serialized objects that have virtual methods, but it wouldn't be as neat or type-safe.

  • hot_gril 2 days ago

    Swift has Codable which seems to work for this, but I haven't used it in forever.

BiteCode_dev 3 days ago

Can captain proto be used there?

  • Bogdanp 3 days ago

    Yes, although I've never used capnproto, I believe the approach it takes is similar: you define your schema, it generates code to do the serialization and to handle the RPCs.

  • hot_gril 2 days ago

    That or regular protobuf would be my go-to for this. Capnproto is faster, but idk if there are more limitations as a result.