Hi Andrew,

Yes, you got it right. Annoyingly you will have to keep that unused Void in
there, but at least it doesn't take any space on the wire.

-Kenton

On Mon, May 1, 2023 at 4:35 PM 'Andrew Sun' via Cap'n Proto <
capnproto@googlegroups.com> wrote:

> Suppose I have a schema that looks like this:
>
> struct Foo {
>     union {
>         bar @0 :Void;
>         baz @1 :UInt64;
>         # ...
>     }
>
>     # ...
> }
>
> Now suppose I want to add information to union member bar, or I want to
> add more fields to baz. What options do I have to do this in a forwards-
> and backwards-compatible manner?
>
> Would this be the "correct" way to evolve the schema?
>
> struct Foo {
>     union {
>         bar :group {
>             unused @0 :Void;
>             foo @2 :UInt32;
>             bar @3 :OtherStruct;
>             # ...
>         }
>         baz :group {
>             a @1 :UInt64;
>             b @4 :Text;
>             # ...
>         }
>         # ...
>     }
>
>     # ...
> }
>
>
> --
> 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 capnproto+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/capnproto/b4a83e9d-9145-4127-b9a6-aefc9500c1b2%40app.fastmail.com
> <https://groups.google.com/d/msgid/capnproto/b4a83e9d-9145-4127-b9a6-aefc9500c1b2%40app.fastmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 capnproto+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/capnproto/CAJouXQnRTitSbn7ObuXjLqLOaBeHo9LaMtOqQ_w1y3X7W2NHhg%40mail.gmail.com.

Reply via email to