4 ms·
Agreed in principle - we shouldn't be afraid of token streams. Thinking in terms of JSON: 1. Its portable - JSON token streams look pretty similar in every lan
by willtemperley 3y ago
Agreed in principle - we shouldn't be afraid of token streams. Thinking in terms of JSON:
1. Its portable - JSON token streams look pretty similar in every language.
2. You're in control. Switching parsing libraries is painful when it's baked into your code (I'm currently weeding out a now unsupported parsing lib and it's painful).
3. It's flexible - try parsing heterogenous websocket JSON
streams with e.g. Swift's Codable. Possible: yes. Easy: no.
4. It's really fast.
If you're in control of the source and sink, the above probably doesn't apply - then it's trivial to make struct-based parsing fast and easy.
(edited to add line breaks)