-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
RFC: "quiet" types for easier-to-read stack traces #48444
base: master
Are you sure you want to change the base?
Conversation
Why does this need a flag in the datatype rather than just having a macro that overrides |
Could this be spelled: struct Foo{A,B,C}
a::A
b::B
c::C
end
Base.Experimental.@quietparams Foo That would for instance allow silencing types you don't own in a debugging session. |
This sounds useful. |
In case it affects thinking on this issue: I think our issues with type-printing go beyond this special case. Someday I'm planning on investigating whether all parameters in stack traces can initially be printed in "folded" form. Now that we have If someone gets excited about this and wants to beat me to the punch, that would be wonderful. But if that doesn't happen, it's on my (long) TODO list. |
FWIW, as a data point in this line of thinking, I've been using https://github.com/BioTurboNick/AbbreviatedStackTraces.jl in the "minimal" mode (one line per frame, with only the function name, without arguments) for a while now, and I very rarely have found the need to have the types of the arguments (or even the argument names). |
I sort of like Tim's idea, where the REPL (with limited=true IOContext) skips showing the type details, but that logs and other non-interactive contexts continue to show all parameters, and |
I agree it would be much better to have stacktraces in the REPL let you interactively expand type parameters. |
We already have FoldingTrees' |
Here are two reasonable paths forward (in mu mind):
|
I'm going to be traveling all next week with very little availability, but if anyone wants to run with this, I just pushed a big head start: https://github.com/timholy/TypeTreesIO.jl. The idea is that whether we print abbreviated type info or have a full UI for folding parameters, it's probably best to have a tree organization of the information that could be printed. For example, if we want to print with a target of no more than 80 characters in the signature, it's probably best to use a homogeneous depth for all arguments and then print anything that's omitted as Feel free to do whatever with that. Contact me by email, discourse, or slack if you're known to me and want an invitation to the repo. |
We are getting lots of feedback from Pumas new users. |
It is fairly common to define types with parameters whose only use is specialization (of code and memory layout), and printing those parameters everywhere can cause excessive noise. One motivating example is https://github.com/SciML/OrdinaryDiffEq.jl/blob/2eb73bed76c31248113fa8f3f05ff2f84448651a/src/integrators/type.jl#L80. The proposed feature here is to put
Experimental.@quietparams
in a struct declaration, and then printing instances and types within stacktraces will omit parameters, e.g.In the case of
ODEIntegrator
, each type can be multiple screens full of text and it is causing quite a problem.