4 ms·
You write a custom marshal/unmarshal method for every type, of course.
by nvarsj 6y ago
You write a custom marshal/unmarshal method for every type, of course.
- kstenerud 6y agoThat's what it does already. But you can't dynamically create a value of a decoded type without reflection, nor can you examine an arbitrary object for encoding without reflection.
- christophilus 6y agoWait. Is that what the built in utility does? I thought it was reflection based. How does it do this without generators?
- kstenerud 6y agoIt's a mix of cached builders and reflection. It uses reflection to build an appropriate builder object for that specific type. Note that it is still using reflection in the builder though.
- marcus_holmes 6y agoI wasn't really referring to the std lib. Though, to be honest, given the amount of hassles I've had marshaling and unmarshaling json in Go, I could well include it ;)