liteserver / binn

Binary Serialization
Apache License 2.0
440 stars 58 forks source link

Missing magic number in specification #21

Closed ghost closed 6 years ago

ghost commented 6 years ago

Hi,

After reading source code, I found the magic number 0x1F22B11F. However specification doesn't mention it. Would you please update specification?

Thank you,

kroggen commented 6 years ago

Hi!

It is not used in the serialized data, it is used only in memory. So it does not need to be in the specification.

ghost commented 6 years ago

@kroggen

Thank you. I'm sorry I din't read the code carefully (I'm not familiar with C).

By the way, I'm writing wrappers in Rust and Java. Both are open sourced under permissive license (similar to 0-BSD). But they're for personal projects, so it could take months to finish :-( I'll send you the links when they're mature enough to be used.

Thanks again for your hard work.

kroggen commented 6 years ago

Wow, really cool!

There are 2 usage experiences that can be implemented for wrappers:

  1. With a similar API as the C one, with one function for each value

  2. Using a single function to serialize and another to deserialize data from/to objects

The last option is easier to use for high level languages and I used this approach for binn.js. If you like it you can check the source.

As well as 2 ways to implement the code:

  1. By simply making wrappers to each binn functions in C, so calling the C library

  2. By rewriting these functions in native language

ghost commented 6 years ago

@kroggen

Thanks I understand and agree with your recommendations too.

I'm sorry that I wanted to mean "implementations" (in native languages), not "wrappers". My English is not good.

By the way, if you have time, could you publish documentation of your C implementation? For example you can publish it to https://liteserver.github.io/binn/apidocs. Specification is a base documentation. But API documentation can help other developers as a guide, to implement in their target languages.