3 ms·
Reflection is essential for things like code generation and introspection in go. It isn't something you can classify as wholly harmful. It is of course possible
by scottlawson 4y ago
Reflection is essential for things like code generation and introspection in go. It isn't something you can classify as wholly harmful. It is of course possible to write bad code using reflection, but not having reflection isn't the solution. https://go.dev/blog/laws-of-reflection https://go.dev/blog/laws-of-reflection
- xg15 4y agoI'm a java guy mostly, so I might be biased, but in that language, the vast majority of overengineered, arcane and plain "black magic" code was involving reflection - whereas I almost never had a problem with generics. So I'm surprised that Go considers generics more harmful than reflection.