Go has reflection, and you can make use of compile time reflection on Rust via the macros infrastructure.
Re:Performance Improvements in .NET 7
by carlhjerpe on Wednesday August 31, 2022 @04:52PM
(#32668200)
Does that cover all mentioned usecases though? They're discussing source generation in this thread, not even close to the same thing (for certain usecases)
Kind of, you can use the parsing package for that, alongside the //go:generate infrastructure.
Or you can use Go reflection package and generate the source code from it.
Of if wanting to do something like Assembly.Emit, generate the machine code directly with a little help from unsafe and syscall packages.
Depends pretty much on the actual use case.
I love reflection, the fact that libraries can look at your types is really really cool.
Not saying it can't be done with a compiled language but I don't see it anywhere.
Being able to load a shared library, search it for classes implementing interfaces, instantiate them and call their methods is pretty slick too.