Re:An unordered list of things I miss in Go
by deergomoo on Sunday August 18, 2024 @11:09AM
(#41282821)
Using pointers feels horrible as a workaround though because it completely muddies the intent. Is it a pointer because it could be zero or <not set>, is it a pointer for performance reasons, is it a pointer because the function mutates it? To me it flies directly in the face of Go's desire to keep things simple and easy to reason about.
> You’d be surprised how infrequently that’s actually a concern though
I admittedly don't write a huge amount of Go, but I run into this fairly often any time I'm dealing with user input. Something like an optional numeric input is not at all uncommon.
Re:An unordered list of things I miss in Go
by metaltyphoon on Sunday August 18, 2024 @11:28AM
(#41282938)
How do you have a PUT on an API to “unset a field”?
Re:An unordered list of things I miss in Go
by Neikius on Sunday August 18, 2024 @02:42PM
(#41284365)
What? That is actually an everyday concern and devs assuming that information is not needed will bring pain down the road.
Just two cases of the top of my head: working with databases and json interop with other systems that actually do differentiate. And the second one should not happen, but people do make assumptions and sometimes those are inherently incompatible with how golang works.
You’d be surprised how infrequently that’s actually a concern though.