rng.md

UniFFI is young, but it is the right bet

tl;dr

  • Use UniFFI when you need one API across Go, Node, Python, and Java.
  • If Go is your only target, cbindgen plus a C FFI is simpler.
  • Async across runtimes is the hard part; header generation is not.
  • UniFFI is still young, and many bindings remain uneven or lightly maintained.
  • I would use UniFFI again for multi-language bindings despite the ecosystem rough edges.

This is my short take on UniFFI after landing SlateDB binding work in PR #1462 and discussing it this Discord thread. If you are choosing between UniFFI and a raw C FFI plus language-specific wrappers, this is the version I would give another engineer.

My Take

  • SlateDB now has official Rust, Go, Python, Java, and Node bindings behind one API. That was the context for this work.
  • If you care about multiple languages, UniFFI is the right thing to be on.
  • It is still early. A lot of the bindings are young or infrequently maintained.
  • The UniFFI maintainers have said they do not want to bless many first-class bindings, so the ecosystem feels a bit wild west right now.
  • I still expect that to improve. The foundation is solid.
  • Go is the easiest target. You can keep the API synchronous and avoid most of the hard runtime work.
  • If I only cared about Go, I would probably use cbindgen and a simpler C FFI layer.
  • That changes once you care about JavaScript, Python, or Java. Async support is the real problem, not header generation.
  • I started down the path of building more of that runtime logic myself, closer to what FoundationDB does across language bindings. UniFFI let me avoid most of that.
  • Writing the Node generator was mostly positive. The hard part was making async feel native to the target runtime.
  • LLMs still struggle with that async boundary. They can help, but only if you test the result hard.

UniFFI is young, uneven, and still the right bet. If I only needed Go, I would probably use cbindgen; if I needed one API across several languages, I would use UniFFI again.

Related posts