qitab / cl-protobufs

Common Lisp protocol buffer implementation.
MIT License
84 stars 18 forks source link

Make unknown enum values pass through in lisp #280

Closed copybara-service[bot] closed 3 years ago

copybara-service[bot] commented 3 years ago

Make unknown enum values pass through in lisp

We can't be sure we will get a member of the decided on set of enums on serialization. The problem occurs if:

v1
enum Foo {
  foo = 1;
}
message bar {
  Foo baze = 1;
}

v2 enum Foo { foo = 1; pika = 2; } message bar { Foo baz = 1; }


One could serialize with pika being the entry in baz
but deserialize on a v1 system!

What we should do is save the enum int that we couldn't understand
and serialize that number to send to someone who may understand it.

What we do here is: if we are a v1 system and got a proto like
bar{ baz = pika}
then we store the baz field as :%undefined-2.
bkuehnert commented 3 years ago

I still don't like it... but the alternatives are worse

Slids commented 3 years ago

I still don't like it... but the alternatives are worse

Alas, Math is about the optimal. Engineering is about the possible.