As someone making custom data structures, I’m curious, how is dump
meant to be used? Are there specific formatting constraints implied? What would constitute expected extension of this function to a user-defined type? What would be considered abuse? The actual description leaves a bit to be desired.
Show every part of the representation of a value. The depth of the output is truncated at maxdepth.
The example seems to imply some conventions we should follow?
julia> dump(x)
MyStruct
x: Int64 1
y: Tuple{Int64,Int64}
1: Int64 2
2: Int64 3
Specific questions: a) it seems it’s a 2-space indentation hierarchical key/value format with a type header… is/should this be strictly followed? b) like a DataFrame, our data could be quite large with many columns/rows, besides depth, would adding a width
and/or height
keyword arguments to constrain dump size be unconscionable? c) when truncating, how would a truncation be indicated …
works in many contexts for us, d) there seems to be a hierarchical key/value like format, is it OK to repeat keys? since our structure is much like XML, forcing unique keys would doubly nest our output making it break from its logical structure, e) must the dump output exactly match the innards of the object, our application has quite a bit of bookkeeping that is distracting for someone who just wants to see -their- data, f) is there some parser or way to check that our dump
output is something expected by the community/tools?
It seems that DataFrame
adds their own “summary” line, which, btw doesn’t match the output of summary
. In the example below, I’ve used … to truncate the “height” of the frame.
DataFrame 9 observations of 5 variables
name: ["JEFFERY A", …]
department: ["POLICE", …]
position: ["SERGEANT", …]
salary: Union{Missing, Int64}[101442, …]
Thank you for any advice/thoughts. I think dump
fits the intent of what I wish to do, and I think something like dump
could be very helpful in the REPL loop or in notebooks. However, it’d really need a way for data to be pruned a bit more to be valuable.