Hacker News new | ask | show | jobs
by rudolf0 4211 days 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}");
1 comments

The 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.