How I use D

Les De Ridder les at lesderid.net
Thu Jul 2 12:59:59 UTC 2020


On Wednesday, 1 July 2020 at 19:35:26 UTC, JN wrote:
> On Wednesday, 1 July 2020 at 10:27:21 UTC, kdmult wrote:
>>
>> Maybe https://kaitai.io/ will be useful to you.
>
> Looks very similar to Google's Protocol Buffers. What is the 
> main benefit of kaitai over protobuf?

If you've worked with Protobuf you will know it's hard to specify
certain things, e.g. relationships between values and types. I 
assume
Kaitai is better at this.

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.


More information about the Digitalmars-d mailing list