RuntimeGeneratedFunctions.jl
RuntimeGeneratedFunctions.jl copied to clipboard
Debugging generated functions
@ChrisRackauckas mentioned that to get a nice stack trace from generated functions, we can print the expression into a temporary file and point the stack trace to that file.
Can this be done automatically with Ctrl - Q functionality in the REPL and other IDEs?
CC: @pfitzseb, @c42f
I feel like I'm missing some context here :) Can't you just insert LNNs to where the expression is defined or something?
There is no file in which the function exists because it's a runtime generated object. Think of SymPy generating a function and then that function errors: how do you show the code that errored to the user?
Ok, I was just going by the example in the readme. Makes sense that that doesn't reflect real usecases though.
It should be fairly easy to support the Ctrl-Q case by overwriting the handler for that and inserting a special marker for RGFs. Generating a clickable link seems impossible without writing a file containing the expr at definition time, which seems like a bad idea.
If we can overload the stacktrace function, we can inject code so that the RuntimeGeneratedFunction can save out a stream to a temporary file and point to that file?
Any updates now?
It hasn't. We know what we want to do, but not how to implement it.