alavrik / piqi

Piqi – universal schema language: JSON, XML, Protocol Buffers data validation and conversion
http://piqi.org
Apache License 2.0
246 stars 36 forks source link

Packed Repeated Fields #9

Closed joelreymont closed 13 years ago

joelreymont commented 13 years ago

I noticed in piqirun-ocaml/piqirun.ml that lists are encoded as Type 1.

Shouldn't lists be encoded as packed repeated fields instead, e.g. Type 2, instead?

alavrik commented 13 years ago

This is not true. Piqi lists themselves are encoded as type 2 and have the same representation as records (or messages when mapped to Protocol Buffers). It is not possible to pack the whole list of elements as a "packed" blob, because "packed" representation is applicable only to primitive numeric types, and list elements can contain arbitrary structures.

However, it is possible to encode list elements (represented as repeated fields) using the "packed" encoding. Adding support for the "packed" encoding for repeated fields and list elements is on the project roadmap and should be done by the end of this month.

joelreymont commented 13 years ago

I would be happy with an array representation of primitive elements, personally. Thanks for correcting me, though.

alavrik commented 13 years ago

Sure. I'll see what can be done here (see my comments on issue 8).

I'm closing this one and keeping issue 8 as a feature request.