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

Shorter stacktrace #15

Merged
merged 1 commit into from
Oct 23, 2020
Merged

Shorter stacktrace #15

merged 1 commit into from
Oct 23, 2020

Conversation

YingboMa
Copy link
Member

Now the stacktrace looks like this instead of the whole type printing with
bytes.

julia> f1(du,u,p,t)
ERROR:
Stacktrace:
 [1] error() at ./error.jl:42
 [2] macro expansion at ./REPL[36]:2 [inlined]
 [3] macro expansion at /Users/scheme/.julia/packages/RuntimeGeneratedFunctions/fIcZp/src/RuntimeGeneratedFunctions.jl:80 [inlined]
 [4] macro expansion at ./none:0 [inlined]
 [5] generated_callfunc at ./none:0 [inlined]
 [6] (::RuntimeGeneratedFunction{(:_du, :_u, :_p, :_t)})(::Array{Float64,1}, ::Array{Float64,1}, ::Nothing, ::Nothing) at /Users/scheme/.julia/dev/RuntimeGeneratedFunctions/src/RuntimeGeneratedFunctions.jl:77
 [7] top-level scope at REPL[42]:1

julia> typeof(f1)
RuntimeGeneratedFunction{var"#_RuntimeGeneratedFunctions_ModTag", (0x47, 0x4a, 0x02, 0xf7, 0xc0, 0xd0, 0xdf, 0x8d, 0x8c, 0xac, 0x18, 0x52, 0x0f, 0x01, 0xbf, 0x94, 0xc0, 0xf6, 0xf1, 0x73, 0x89, 0x1b, 0xe5, 0x1d, 0x94, 0x75, 0xa9, 0xbf, 0x06, 0xa0, 0x96, 0xd5, 0xbb, 0xd3, 0xfa, 0x0d, 0xfd, 0xb4, 0x1f, 0xec, 0xfd, 0xb3, 0x6a, 0x05, 0x53, 0x92, 0x3a, 0x59, 0x0e, 0x35, 0x51, 0x05, 0xe8, 0xd4, 0x28, 0xec, 0x95, 0x97, 0x9b, 0x78, 0xe0, 0x1b, 0xc9, 0x9c), (:_du, :_u, :_p, :_t)}

Now the stacktrace looks like this instead of the whole type printing with
bytes.
```julia
julia> f1(du,u,p,t)
ERROR:
Stacktrace:
 [1] error() at ./error.jl:42
 [2] macro expansion at ./REPL[36]:2 [inlined]
 [3] macro expansion at /Users/scheme/.julia/packages/RuntimeGeneratedFunctions/fIcZp/src/RuntimeGeneratedFunctions.jl:80 [inlined]
 [4] macro expansion at ./none:0 [inlined]
 [5] generated_callfunc at ./none:0 [inlined]
 [6] (::RuntimeGeneratedFunction{(:_du, :_u, :_p, :_t)})(::Array{Float64,1}, ::Array{Float64,1}, ::Nothing, ::Nothing) at /Users/scheme/.julia/dev/RuntimeGeneratedFunctions/src/RuntimeGeneratedFunctions.jl:77
 [7] top-level scope at REPL[42]:1

julia> typeof(f1)
RuntimeGeneratedFunction{var"#_RuntimeGeneratedFunctions_ModTag", (0x47, 0x4a, 0x02, 0xf7, 0xc0, 0xd0, 0xdf, 0x8d, 0x8c, 0xac, 0x18, 0x52, 0x0f, 0x01, 0xbf, 0x94, 0xc0, 0xf6, 0xf1, 0x73, 0x89, 0x1b, 0xe5, 0x1d, 0x94, 0x75, 0xa9, 0xbf, 0x06, 0xa0, 0x96, 0xd5, 0xbb, 0xd3, 0xfa, 0x0d, 0xfd, 0xb4, 0x1f, 0xec, 0xfd, 0xb3, 0x6a, 0x05, 0x53, 0x92, 0x3a, 0x59, 0x0e, 0x35, 0x51, 0x05, 0xe8, 0xd4, 0x28, 0xec, 0x95, 0x97, 0x9b, 0x78, 0xe0, 0x1b, 0xc9, 0x9c), (:_du, :_u, :_p, :_t)}
```

Co-authored-by: "Shashi Gowda" <[email protected]>
@codecov
Copy link

codecov bot commented Oct 23, 2020

Codecov Report

Merging #15 into master will decrease coverage by 8.18%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #15      +/-   ##
==========================================
- Coverage   90.00%   81.81%   -8.19%     
==========================================
  Files           1        1              
  Lines          40       44       +4     
==========================================
  Hits           36       36              
- Misses          4        8       +4     
Impacted Files Coverage Δ
src/RuntimeGeneratedFunctions.jl 81.81% <ø> (-8.19%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2953c18...9b9426e. Read the comment docs.

@ChrisRackauckas ChrisRackauckas merged commit 2a3f734 into master Oct 23, 2020
@ChrisRackauckas ChrisRackauckas deleted the sm/stacktrace branch October 23, 2020 16:09
@ChrisRackauckas
Copy link
Member

Thank god.

@c42f
Copy link
Contributor

c42f commented Oct 24, 2020

Note that overriding show(::IO, ::Type{SomeType}) has a bit of a bad reputation of causing instability. See for example: PainterQubits/Unitful.jl#321

Unfortunately I don't know exactly what's wrong with doing this, I just remember it being discussed on a few occasions.

@devmotion
Copy link
Member

Interesting 👍 Maybe it would be helpful to change the order of the type parameters such that the argnames are displayed more prominently in stacktraces, instead of implementing show(::IO, ::Type)?

@c42f
Copy link
Contributor

c42f commented Oct 24, 2020

Could be done. Or I thought sha512 seems like overkill anyway and we could just use sha1. And also shorten the tag name to get something like

julia> typeof(@RuntimeGeneratedFunction(:((x,)->x+1)))
RuntimeGeneratedFunctions.RuntimeGeneratedFunction{var"#_RGF_ModTag",(0x19cc2a7a, 0xeba7d29f, 0x2c764791, 0x3c9e5a40, 0xfadc08ad),(:x,)}

@c42f
Copy link
Contributor

c42f commented Oct 24, 2020

change the order of the type parameters such that the argnames are displayed more prominently in stacktraces

I tried this in #16, along with the other ideas to make the types a bit less horrible.

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

Successfully merging this pull request may close these issues.

4 participants