9 ms·
It is more an expression of confusion rather than type system quality evaluation, but why does JSON parser's implementation returns its own types like JsonNode?
by feduzi 10y ago
It is more an expression of confusion rather than type system quality evaluation, but
why does JSON parser's implementation returns its own types like JsonNode? Why doesn't it just return core types like:
* JSON String -> NIM String
* JSON Object -> NIM Hash
* and so on...
I've also had the same question when looking at https://crystal-lang.org https://crystal-lang.org.
PS: I do not claim Nim's type system to be bad as I do not have an exact counterexample of a "better" type system.
- dom96 10y agoBecause the type of a JSON object's fields is not known at compile-time. let s = parseJson("{'A': 'foo'}") s["A"] # What type is this? We don't know until we parse the JSON.
- deleted 10y ago[deleted]