How I use D

Jesse Phillips Jesse.K.Phillips+D at gmail.com
Fri Jul 3 03:50:16 UTC 2020


On Thursday, 2 July 2020 at 12:59:59 UTC, Les De Ridder wrote:
>
> For example, in Protobuf you can't really specify that the 
> value of a
> field will determine the type of the next field. It expects you 
> to just
> use something like a field for the type id, and a dynamic/byte 
> array
> field for the payload, to then do the type casting in 
> application code.
>
> For things like container file formats this makes Protobuf 
> insufficient,
> but for its main purpose, defining binary wire protocols, it's 
> not as
> much of an issue.

I'm trying to figure out how to ask this clarifying question. I 
have not done much with protobuf usage but do agree it isn't 
really meant for file storage.

I did a parser for open street maps[1] years ago. They utilized 
protobuf to define the file format of the inner protobuf.

When you say you need a byte array I don't understand why you 
would not just fill a field with the type you want. But like I 
said it was years ago and I do not remember if osm would clarify 
that for me.




1. 
https://github.com/JesseKPhillips/libosm/blob/master/examples/dump/source/app.d


More information about the Digitalmars-d mailing list