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

Record where thunks actually created #58

Merged
merged 2 commits into from
Oct 23, 2019
Merged

Record where thunks actually created #58

merged 2 commits into from
Oct 23, 2019

Conversation

oxinabox
Copy link
Member

Is this enough to close #57 ?

Should I test this? Maybe can throw error, then access the backtrack as a string,
and then make sure the right file name occurs?

Before

julia> demo_pb() = @thunk(error("no"))
demo_pb (generic function with 1 method)

julia> extern(demo_pb())
ERROR: no
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] (::var"#15#16")() at /Users/oxinabox/JuliaEnvs/ChainRulesWorld/ChainRulesCore.jl/src/differentials.jl:216
 [3] (::Thunk{var"#15#16"})() at /Users/oxinabox/JuliaEnvs/ChainRulesWorld/ChainRulesCore.jl/src/differentials.jl:223
 [4] extern(::Thunk{var"#15#16"}) at /Users/oxinabox/JuliaEnvs/ChainRulesWorld/ChainRulesCore.jl/src/differentials.jl:224
 [5] top-level scope at REPL[12]:1

After

julia> extern(demo_pb())
ERROR: no
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] (::var"#13#14")() at ./REPL[9]:1
 [3] (::Thunk{var"#13#14"})() at /Users/oxinabox/JuliaEnvs/ChainRulesWorld/ChainRulesCore.jl/src/differentials.jl:232
 [4] extern(::Thunk{var"#13#14"}) at /Users/oxinabox/JuliaEnvs/ChainRulesWorld/ChainRulesCore.jl/src/differentials.jl:233
 [5] top-level scope at REPL[10]:1

Note that in the real use case when not testing it in the REPL
will whow a filename and line number rather than
[2] (::var"#13#14")() at ./REPL[9]:1

@nickrobinson251
Copy link
Contributor

nickrobinson251 commented Oct 23, 2019

Made you a label 🏷 😀

@nickrobinson251
Copy link
Contributor

I really like this. Just needs tests :)

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.

Make it easier to track down errors that occur in a thunk
2 participants