qitab / cl-protobufs

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

Changes to the field-descriptor class #167

Closed copybara-service[bot] closed 4 years ago

copybara-service[bot] commented 4 years ago

Changes to the field-descriptor class

-- ac7e9c203cf3f0632936fb801d27961ff7d18e5c by Ben Kuehnert benkuehnert@google.com:

Remove manual schema definitions in test files

Due to the changes to protoc, these schemas are no longer valid. They should be defined in .protos and compiled with protoc anyway.

-- efefc069d08e701bfdc8a48ba306405b552e52ed by Ben Kuehnert benkuehnert@google.com:

Update protoc with new type/class semantics

Now, "type" is the base lisp type of the field, and "class" is the type of proto object the field is: either :scalar, :message, :group, :enum, or :map.

-- eccc8aee1257f57f5b184da96399a69e16f2ac57 by Ben Kuehnert benkuehnert@google.com:

Update field-descriptor slots.

TYPE is the base lisp type of the field. "Base" here means that if a field is repeated then we put the underlying type rather than (list-of type). CLASS is a keyword indicating if the type names a scalar, enum, message, group, or map. For scalars this information is redundant, and at run-time it is redundant since you can just call (find-* ...) on the field's type. However, we need this information at compile time, and the run-time work-around is a bit of a hack. CONTAINER indicates which lisp container is used for repeated fields. It is either :list, :vector, or nil (non-repeated types only). This data could probably be stored in the LABEL slot, so :repeated would be replaced with :list or :vector. However, I'm not so sure about that since that seems to muddy the waters between proto spec and our own lisp-only extensions.

-- aecb68206b4b72979fd00c37c7d6bab619721a1f by Ben Kuehnert benkuehnert@google.com:

Update wire-format to use lisp types rather than keywords

-- 1cacc5a90b8a2b2827ed972b3d52286bb58417f5 by Ben Kuehnert benkuehnert@google.com:

Update map types with new class/type semantics

-- 10a3d0421ad69883244e5f83b6d401655635eff6 by Ben Kuehnert benkuehnert@google.com:

Remove clos-transform as it is now unecessary

-- 15894c494ff4b8f1648ec8d2414971c1c1530ff0 by Ben Kuehnert benkuehnert@google.com:

Update text format

-- 51f105a0bac7981c13eb16a90a4247e0aa10e74b by Ben Kuehnert benkuehnert@google.com:

Update serialize.lisp with new type/class meaning

-- 528967f8e7720838e68e67e500c2372d6c17861b by Ben Kuehnert benkuehnert@google.com:

Fix bug in non-repeated-bool-field defun.

This function previously returned true if and only if the field form contained 'cl:boolean' AND contained ':repeated'. However, field forms do not contain ':repeated', and instead they contain (:repated :list) or (:repeated :vector). The reason this function worked, is because repeated boolean fields would have the type (list-of cl:boolean), and hence the form would not contain 'cl:boolean. This fixes that bug.

-- a73beac0dfaba871e71d35157b5e0fe2bb73def3 by Ben Kuehnert benkuehnert@google.com:

Update generated code to match new field descriptor

  1. Type now always means the base lisp type of the field
  2. Class identifies which "class" of proto type the field is
  3. :initform is the initform used for the field. :default is removed.

-- 54bcb529b415caf977fd78e0aec73d0b635d696d by Ben Kuehnert benkuehnert@google.com:

Replace proto-class with proto-type where appropriate

-- c46cdac1ce8cd7a8bcd59d989606f5bea32e71de by Ben Kuehnert benkuehnert@google.com:

Fix up tests

-- 0cd2d1d43bd06b9fa2cc487ae2f8d1cd297c56f4 by Ben Kuehnert benkuehnert@google.com:

Add new testing proto files and remove clos-transform

-- 4e2be961a4919f0cdd35da84c5dccd9da963007e by Ben Kuehnert benkuehnert@google.com:

Add comment to clarify type slot

-- c589b0cdbd6ba7204b2430d91faf949ba05b6e55 by Ben Kuehnert benkuehnert@google.com:

Fix bugged function

This function would crash if the message had an optional bool field. This commit fixes that and cleans up the function.

-- c2f98cf3fadec0ad81f1e5bf3ec40d49f5867560 by Ben Kuehnert benkuehnert@google.com:

Fix some style warnings from ABCL

-- 4d2d37803c7b5001d5848a7bcfb028d3edd4a671 by Ben Kuehnert benkuehnert@google.com:

Add more robust error checking to get-default-form

This function should signal an error when we ask for the default of an unknown type/class combo. Previously, the default of a type would always be NIL if none was set. This seems like something that could cause hard-to-debug errors.

-- cafe9c09a263012c80ae49c6b8525f32fb7d86b2 by Ben Kuehnert benkuehnert@google.com:

clarifiy 'desc' binding

-- 2000a1b0b880c3aa54b3a5802247dbd39e51ccbe by Ben Kuehnert benkuehnert@google.com:

spacing

-- eefeb8273aa1df02f45c33342b96d7f4c3e3d788 by Ben Kuehnert benkuehnert@google.com:

Allow CCL compilation

CCL requires these types to be nullable, since they are populated from macroexpansions and CCL seems to be ignoring type declarations. Until we come up with a better work-around, this will have to do.

-- d7ec3b3eb86ccc690de6d1cd85eadc48ac99f1e4 by Ben Kuehnert benkuehnert@google.com:

Update constants to have more transparent names

-- 7f30ca0801ee12dd895122f3f1c2b46c7baf41e4 by Ben Kuehnert benkuehnert@google.com:

Remove large let bindings/setqs.

Multiple times in serialzation and text-format, I added let bindings that would eventaully be setq'd to the proper descriptor of the type being (de)serialized/printed/parsed. This commit removes that.

-- e4c66d4b3d91ef30cbb159a7cea2e3b4da76b363 by Ben Kuehnert benkuehnert@google.com:

update serializer call to be more transparent, and remove unecessary binding

-- 5506d948d1f06bb10d93c1d3889187d0d89ee83c by Ben Kuehnert benkuehnert@google.com:

Rename field's :class slot to :kind

-- 4f3ab0cf9b6c603eafdea7040511f99a81d9a606 by Ben Kuehnert benkuehnert@google.com:

Revert default -> initform change

Due to flaws in the definer macros, the field-descriptor still needs to keep track of any custom default that is set. However, there is no need to keep track of an initform. This change removes the initform slot, and replaces it with the original default slot.

-- 8fc11fae629bee15d5a431e60d746901358549fc by Ben Kuehnert benkuehnert@google.com:

Fix lint errors