Hacker News new | ask | show | jobs
by unmdplyr 1832 days ago
> Being able to type out messages is hugely helpful while debugging and developing

You are only a small fractional part of the entire life of the protocol. Protocol designs largely impact hardware design and requirements. A binary protocol will safely work on a micro-controller without too much effort while a text based protocol requires some serious CPU juice, code storage space and volatile memory to get it off the ground.

Sure, text will work on most devices, but the parsers for those text based protocols become excessively complex. There is some ideas floating on in the field of "green" computing where its becoming increasingly imperative to do more processing per watt. Text parsers will certainly not fit into that bill.

> new fields myself without having to write code to do it.

Then what's the point of that new field if there's no code to handle it? That said, CBOR and TLV is similar too -- in that, you can add new fields without any code to handle it. But what good is it?

> An unexpected field value/type, and a generally malformed payload.

    Content-Length: bad-string
Your parser will break the key-value pair and hand it off to a call-back or something that makes sense of what key means, perhaps a semantic analyzer? And when it reaches that point, you have irreversibly wasted enough CPU time already only to discover that the whole message is invalid. Not that I am unaware of the difference, just that differentiating them is often pointless.

Continuing the hilarity...

> That's hard to read so lets use specialized

Is it CR? Is it LF? Is it CRLF? Did I configure my text editor to use the correct line terminator? Does my clipboard reset the CRLF to CR or LF? Oh, wait is that a space (0x20) or tab (0x09) there? Hmm.. never mind.

Also,

    From: 1234<1234@example.org>;branch=abcd1234
vs

    From: 1234<1234@example.org;branch=abcd1234>
Which is the right way? Should my parser expect `branch` in URI or should it expect only when parsing `From` and `To` address? Should I make it part of the URI sub-parser or should I make it part of the top-level parser for endpoint addresses? This was a real inter-op problem between two big vendors.