Hello
I am finding myself debugging at large Julia codebase and for some reason I still debug like a 2nd year undergraduate. For that reason I would like to make a macro that looks some thing like this:
macro pp(input)
:(println("File: ", @__FILE__ , "Line: ", @__LINE__, " ", <variable name of input>, " ", <actual value of input>))
end
The idea is that I can compare variables across multiple files quickly and find their location, but I cannot get it to work probably as the @__FILE __ and @__LINE __ macros refer to the file and line of the macro definition. (A kind of related question: how to get the variable name of the input of the macro?) A minimal working example could be:
macro pp(input)
:(println("Line: ", @__LINE__, "Name: ", " <name of input> " , $input))
end
a = 1; @pp a
Which returns:
Line: 2 Name: <name of input> 1
Does anyone know a good approach for these kinds of macros, I find my self trying every kind of combination of esc(), $ and : to get it to work.
Kind regards