Save RuntimeGeneratedFunction or Expr to file for later use

Yeah I realized the Expr can be saved to JLD2. I’m not so familiar with how @generated is supposed to work. Are you suggesting something like:

@generated function(path)
     return load(path, "expr")
end

With this approach would the only thing happening at pre-compile time be the loading of the expression from the file? Do you see issues if I pre-compute the files and ship them in a package? I see some other threads with world age issues but I do not completely understand that.

Could do I think as well. Not sure the pros/cons of each

function (path)
   return @RuntimeGeneratedFunction((load(path, "expr"))
end