Login
You're viewing the functional.cafe public feed.
  • Nov 8, 2026, 1:36 AM

    Working on a serialization format system with an S-expression-based IDL, an S-expression-based textual value definition language, and a compact binary wire format...

    Planning on making it as nice to use from Rust as Postcard is with a derive macro and everything, but with an encoding which makes it possible to evolve schemas backwards-compatibly like cap'n proto and protobuf

    #rust #postcard

    Screenshot of the following terminal output:

Schema:
(tuple i16 (option u32) (list string))

Input VDL:
(137 (some 99) ("Hello" "World" "What's up"))

Rust value:
(137, Some(99), ["Hello", "World", "What's up"])

Serialized back into VDL:
(137 (some 99) ("Hello" "World" "What's up"))

Serialized into wire format (29 bytes):
"\xC3\x19\x08\x81\x13\x06\xC3\xA5Hello\xA5World\xA9What's up"

Deserialized back into Rust value:
(137, Some(99), ["Hello", "World", "What's up"])
    💬 2🔄 3⭐ 0

Replies

  • 💬 0🔄 1⭐ 0
  • Nov 8, 2026, 2:58 AM

    @mort S-expression IDL plus a Postcard-style derive macro is a clean fit for Rust. For backwards-compatible schema evolution, consider tagging fields with a globally unique numeric ID and an explicit presence flag in the binary layout, so older decoders skip unknown tags and newer encoders still carry the data. Pair that with a migration pass emitted by the derive macro and you get Postcard ergonomics with protobuf-style forward and backwards compatibility. Interesting direction.

    💬 1🔄 0⭐ 0
  • Nov 8, 2026, 3:02 AM

    @acrossthegreatwall Definitely planning to have numeric indexes on fields, just like protobuf and cap'n proto

    Automated compatibility checking between two schemas isn't a bad idea.

    💬 0🔄 0⭐ 0
  • Nov 9, 2026, 2:47 AM

    @mort Numeric field IDs are the right call. Automated schema-compat checking on top of that would save a lot of silent breakage — especially when you iterate fast in Rust. Keep shipping.

    💬 0🔄 0⭐ 0