Retroactive unionization is only backwards compatible, not forward
compatible, right?  So, if I start with this struct:

    struct Person {
      name @0 :Text;
      email @1 :Text;
    }

And decide that I want to evolve it to this one:

    struct Person {
      name @0 :Text;
      union {
        email @1 :Text;
        age @2 :Float64;
      }
    }

(I know it's not a very meaningful example).

If I write something in the new spec that uses the age branch of the
union, the old struct can try to read it, and get very confused.  In
particular, if someone tries to read the email for a struct that
actually populates age, they'll end up reading a Float64 as if it were
a pointer to a text block.

Am I understanding the issue correctly? If so, how do people handle
these kinds of protocol changes?  Do people use retroactive
unionization in practice?  Do people use schema validation of some
kind to detect when someone makes a potentially unsafe change like
this one?

y

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/capnproto/CACLX4jRucxh5%2BmrvkkbcvTgmEbxeAcY%2BEJa4XKw5y_-DZGHorQ%40mail.gmail.com.

Reply via email to