4 ms·
I understand pointers and structs just fine, it's just that you would think a modern language like Go would avoid use of pointers to structs and "bring-your-own
by rudolf0 12y ago
I understand pointers and structs just fine, it's just that you would think a modern language like Go would avoid use of pointers to structs and "bring-your-own-buffer" type calling conventions except wherever possible. It makes for ugly developer APIs, in my opinion.
That is, in a "friendly" language I expect to generate JSON like this (in pseudocode):
HashMap parsed = JSON::parse("{1: 2}");
not
JSONObj obj;
JSON::populate(&obj, "{1: 2}");
- enneff 12y agoThe former is how it might work in a dynamically typed language. In a statically typed language, like Go, there are great benefits to decoding into the fields of struct with fields of known types.