Open ericphanson opened 8 months ago
Does repr
give you something useful? IIUC that's meant to be the "gimme a string I can eval
to get this thing back" function, not print
It does not:
julia> repr(TimeSpan(0,1))
"TimeSpan(00:00:00.000000000, 00:00:00.000000001)"
Also:
help?> repr
search: repr replaceproperty! reinterpret repeat replace replace! replacefield!
repr(x; context=nothing)
Create a string from any value using the show function. You should not add
methods to repr; define a show method instead.
huh, well there ya go. adding a string constructor and putting quotes around makes the most sense to me then.
Currently, we print them as things like
TimeSpan(00:00:00.000000000, 09:45:00.000000000)
. This can be nice since it's "readable" but it is frustrating if you need to copy-paste into a REPL or such. I think we should use a roundtrippable implementation.One option if we are attached to the current printing is to print it like
(with quotes) and add a
TimeSpan(::AbstractString, ::AbstractString)
constructor to parse the strings.