In some binary data description format, I didn't include unions because they are just a special case of what I called "conditional sequences". But then I added them, because it is very difficult or impossible to figure out whether a set of conditional sequences corresponds to a union (all must have same size, which is only known at encoding/decoding, and only one must be present), which you need to know when converting into more restrictive formats that only support unions.
A Critique of the Cap'n Proto Schema Language (2019)
41–50 of 73 posts
Re: A Critique of the Cap'n Proto Schema Language (2019)
#42Earlier quoted context omitted.
it depends on what type of safety. The schema language might for example allow you to specify that an input string/blob should be smaller than 10MB and refuse to deserialize it if it is longer, same for array/list/vector length.
> ... allow you to specify that an input string/blob should be smaller than 10MB and refuse to deserialize it if it is longer ... why ? are there no cases where serializing even larger file is valid ?
Re: A Critique of the Cap'n Proto Schema Language (2019)
#43Earlier quoted context omitted.
it depends on what type of safety. The schema language might for example allow you to specify that an input string/blob should be smaller than 10MB and refuse to deserialize it if it is longer, same for array/list/vector length.
It feels like a check against an input size of 10MB is something you would do well before deserialization, no?
A concrete example might be a batching third party client: the app sends N messages in a single batch and each message has its own size limit.
Re: A Critique of the Cap'n Proto Schema Language (2019)
#44Great post, digestible without experience in capn proto specifics. I really like that they talk in terms of “features carrying their own weight” and survey real world code to see what cases features solve for, and how (surprisingly little) certain features are actually used. A side effect of dropping features when designing for code generation (in this case) is that it makes things more concise for everyone else as w…
Re: A Critique of the Cap'n Proto Schema Language (2019)
#45>Cap’n Proto unions are not first class types. Instead, they are fields of structs In some binary data description format, I didn't include unions because they are just a special case of what I called "conditional sequences". But then I added them, because it is very difficult or impossible to figure out whether a set of conditional sequences corresponds to a union (all must have same size, which is only known at enc…
Re: A Critique of the Cap'n Proto Schema Language (2019)
#46Earlier quoted context omitted.
it depends on what type of safety. The schema language might for example allow you to specify that an input string/blob should be smaller than 10MB and refuse to deserialize it if it is longer, same for array/list/vector length.
It feels like a check against an input size of 10MB is something you would do well before deserialization, no?
Re: A Critique of the Cap'n Proto Schema Language (2019)
#47Rest in peace, Ian, my friend.
For context: it seems that the author passed away on last July https://www.winchesteruu.org/2023/07/25/joys-sorrows-and-tra...
Re: A Critique of the Cap'n Proto Schema Language (2019)
#48Earlier quoted context omitted.
> Serialization and parsing are security minefields and it is dangerously naive to just hand-wave that away. well, i am not hand-waving them away, i am not sure what can the serialization framework possibly _do_ to make things secure during the serialization ? when execution of user-supplied code is allowed (in the examples that you have outlined above), surely, the layer _executing_ the code cannot really do anythin…
> I am not sure what can the serialization framework possibly _do_ to make things secure during the serialization Loads of things! A strict specification that can only be interpreted one way goes very far. E.g.: a machine-readable BNF grammar file or something similar with no ambiguities. A conformance test suite covering corner-cases is surprisingly effective, even with a supposedly perfect spec. "Be strict with wha…
Re: A Critique of the Cap'n Proto Schema Language (2019)
#49Re: A Critique of the Cap'n Proto Schema Language (2019)
#50Why do all these serialization frameworks like protobufs, flatbuffers, capnproto, etc. have bespoke schema languages? Why not just use JSON-based schema so that you don't need custom parsers for it? It would definitely make metaprogramming easier as well.
Consider:
struct Person {
name @0 :Text;
age @1 :UInt16;
}
vs.: "declarations": [
{
"name": "Person",
"kind": "struct",
"fields": [
{
"name": "name",
"type": "text",
"ordinal": 0
}, {
"name": "age",
"type": "uint16",
"ordinal": 1
}
]
}
]