Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better backtraces #14

Open
mauro3 opened this issue Aug 10, 2016 · 5 comments
Open

Better backtraces #14

mauro3 opened this issue Aug 10, 2016 · 5 comments

Comments

@mauro3
Copy link
Owner

mauro3 commented Aug 10, 2016

Use the trick Tim used in mauro3/SimpleTraits.jl#6 to get better backtraces.

@mauro3
Copy link
Owner Author

mauro3 commented Feb 9, 2017

@bramtayl
Copy link

I started trying to work on this but I think the code surgery got a little out of hand. One reasonable first step would be to use MacroTools exclusively for expression decomposition. Then I could write a wrappers for macrotools such that any numbered line inputs will yield numbered line outputs. Then comes the question of how to put these pieces together, that is, which part of the generated code you want to point back to which original line.

@mauro3
Copy link
Owner Author

mauro3 commented Mar 23, 2017

Hi @bramtayl, thanks for looking into this! I'm not 100% sure that MacroTools will work for 100%, but using more MacroTools is definitely good. I think starting non-fancy and just referencing the first line of the type def would be fine.

But I'm off on holidays now and then crazy conference prep. So, don't expect much from me until the end of April.

@bramtayl
Copy link

bramtayl commented Jul 5, 2017

I realized today I had been thinking about this wrong. It seems like you would want backtraces to point to lines in the Parameters.jl file in @with_kw and not to lines in user code (that should already be clear in the stack trace entry which points to the macrocall location). This is in fact already the case; if you @macroexpand @with_kw ... you'll see code chock full of references to lines in Parameters.jl.

@mauro3
Copy link
Owner Author

mauro3 commented Jul 5, 2017

Thanks for spending your brain cycles on this!

There is probably a bit of both, but I think more the user-code (I assume that the Parameters.jl code is bug free ;-). Example:

julia> using Parameters                                                                                                                
                                                                                                                                       
julia> @with_kw type AA
       b=c
       end                                                                                                                             
AA                                                                                                                                     

julia> AA()                                                                                                                            
ERROR: UndefVarError: c not defined                                                                                                    
Stacktrace:                                                                                                                            
 [1] AA() at /home/mauro/.julia/v0.6/Parameters/src/Parameters.jl:376                                                                  

Here it would be better to point to the user-code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants