qitab / cl-protobufs

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

Specify enum defaults and allow enum field to be any keyword #279

Closed copybara-service[bot] closed 3 years ago

copybara-service[bot] commented 3 years ago

Specify enum defaults and allow enum field to be any keyword

At compile time we can't be sure we know the default value of an enum in lisp. We also can't be sure the function to get the default value is defined. We can be sure the c++ protoc layer knows, so just use that.

Also, 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! This is bad. Step 1 in cleaning this up is let a enum field be a keyword.