Why is it the case that reflection is not permitted from within generated functions? (I know that e.g. Zygote does it, but I get the impression that’s frowned upon). I had a search through old posts but can’t find a clear answer. If I’ve missed a well-known post, I would appreciate a pointer towards it!
My confusion stems from the fact that I cannot see why is not safe to call e.g. Base.code_ircode_by_type(sig; world, interp, optimize_until)
from a generated function (using the version of a generated function where you get access to the world age). I guess that I can’t see why the returned IRCode
ought not to be a pure function of these arguments. Or does constructing a NativeInterpreter involve making use of something global and stateful?