News for hackers. Stuff that matters.
Re:Show HN: Jason – A new JSON Library for Go by ryanlschneider on Tuesday December 02, 2014 @12:19PM (#8688267)
Speaking of the .Get method, wouldn't returning an error alongside the value instead of just the default object be more idiomatic?
Re:Show HN: Jason – A new JSON Library for Go by courtf on Tuesday December 02, 2014 @02:37PM (#8689306)
I think it would be nice to return a bool, rather than an error. It really is just a binary condition and this pattern fits nicely with accessing values in maps. That said, I haven't really found a need for a .Get method in my own code, and will probably just stick with encoding/json for the time being.
Re:Show HN: Jason – A new JSON Library for Go by libria on Tuesday December 02, 2014 @12:29PM (#8688352)
It looks like .Get uses the null pattern (ie, returns a Jason struct with data = `nil` if nothing is found). Your way is more idiomatic, but it looks like his point with this library is to access the data conveniently in exchange for type-safety. `exists()` can verify something was found if needed.