4 ms·
Reflection is inherently unsafe. Even something as relatively simple as a JSON de/serializer can blow up in your face. Source generators are compile-time safe.
by piaste 4y ago
Reflection is inherently unsafe. Even something as relatively simple as a JSON de/serializer can blow up in your face.
Source generators are compile-time safe. Well, unless they generate unsafe code, of course, but most of them shouldn't and don't.
They're also safer in a broader sense in that any "implicit" changes will show up in the version control history, if you commit the generated code (which you should!).