4 ms·
> Is it? How? There's like a million built-in types and too many unnecessary options for specifying constraints. > What is an alternative you like better? I
by kentonv 7y ago
> Is it? How?
There's like a million built-in types and too many unnecessary options for specifying constraints.
> What is an alternative you like better?
I think Protobuf has a simpler, more practical type system and more accessible syntax compared to ASN.1.
Cap'n Proto is very close to Protobuf in terms of type system and syntax, but adds some polish on both. (But Cap'n Proto is my own design, so obviously I think it's the best.)
In terms of encoding, Cap'n Proto is, of course, completely different from Protobuf. I guess it is closer to PER and OER... but not particularly close.
- cryptonector 7y agoProtobufs is a TLV encoding no better than DER. If it's just the syntax, then it's not much of an upgrade. Syntax is not a big deal, but semantics is, and there hasn't been much, if anything at all that's new semantics-wise since ASN.1. (Of course, that the ASN.1 syntax is difficult to parse with LALR(1) parsers is a problem. But the syntax doesn't have to change much to be easier to parse.) You don't have to know about and use all the built-in universal types in ASN.1 -- they're there if you need them. Protobufs is just a history-repetition disaster. IDK about Cap'n Proto, but I'm glad it's closer to PER/OER, if it is.
- kentonv 7y agoI'm saying both the syntax and semantics (i.e. type system design) of protobuf are much superior to ASN.1 (mostly, by being much simpler and easier to understand). I believe syntax and type system are, in fact, much more important than the encoding details. To most application developers, there is no difference whatsoever between protobuf encoding, BER, DER, PER, OER, etc., because they never see the encoding. The library and tools handle that part. As long as the data gets through end-to-end with acceptable performance, nobody cares how it is represented in the interim. Cap'n Proto's encoding is different in that by being zero-copy it actually enables new use cases, like mmap()ing a very large file for random access. Still, I'd certainly choose protobuf's syntax and encoding over ASN.1's syntax paired with Cap'n Proto's encoding.