News for hackers. Stuff that matters.
Re:Go Replaces Interface{} with 'Any' by kubb on Tuesday December 14, 2021 @08:03PM (#29560600)
Basically macros, like in Rust, not like in C. Rust can do stuff like the serde serialization library while Go has to rely on reflection with its obvious performance drawbacks.
Re:Go Replaces Interface{} with 'Any' by rp1 on Tuesday December 14, 2021 @08:34PM (#29560905)
Go could do something similar if you're willing to run `go generate` as part of your build process. For most Go applications, the reflection overhead is a fine price to pay for convenience, just like GC is a fine price to pay for not having to deal with the borrow checker. Obviously, these tradeoffs don't hold for all programs, but Go has definitely found a niche.
Re:Go Replaces Interface{} with 'Any' by kubb on Wednesday December 15, 2021 @05:15AM (#29563984)
I'm not sure what you're arguing with. I know these things. I'm still missing the ability to have efficient serialization (as one example) easily. It matters.
Re:Go Replaces Interface{} with 'Any' by rp1 on Thursday December 16, 2021 @05:41PM (#29584984)
I’m not arguing. I was just highlighting that you could easily implement a json library that uses go generate instead of reflection. I was positing that such a library hadn’t been made yet because the perf hit of reflection is fine for most people. Also, just an aside, if perf is a concern than JSON isn’t a good choice to begin with.