3 ms·
Parsing is simple, you just need to be explicit about what you expect to parse. Like, write 10 lines of straightforward parse function (or maybe better, data de
by jstimpfle 7y ago
Parsing is simple, you just need to be explicit about what you expect to parse. Like, write 10 lines of straightforward parse function (or maybe better, data description + your own code that you use for all your types) that fills your object's fields. Alternatively, if you have a super structured approach about your data (like you're required to have with template metaprogramming) then you can easily generate this stuff. Like, using a usable scripting language or such.
The idea that types can replace code is just broken. The type system is not a programming language. Or at least, as proven by C++/Haskell/..., not a remotely usable one.
- chrisseaton 7y ago> Parsing is simple It's obviously not simple - no two parsers have the same behaviour! http://seriot.ch/parsing_json.php http://seriot.ch/parsing_json.php
- jstimpfle 7y agoTip, if you want to defeat an argument by quoting only three words, make sure you're talking about the same thing. To be clear, I was not talking about lexing JSON, but about how to configure a "meta-parser" like this library to actually convert some JSON to concrete application data objects. The point of contention was, "should we really use such a massive library or mustn't it be sufficient to have a simple bag of parsing primitives (which we can use to actually build the right thing)". And I'm not a fan of JSON either...
- chrisseaton 7y agoParsing JSON is not simple - not even when you know the structure you're parsing against. For example that reference shows even parsing numbers is not the same everywhere, so that applies even when the structure is as expected. > Tip, if you want to defeat an argument by quoting only three words, make sure you're talking about the same thing. Please don't be snarky - if you disagree say so and why.
- jstimpfle 7y ago> if you disagree say so and why. My apologies. Just did that - I'm habitually a post-then-improve type of commenter.