Skip to content

Commit 911c203

Browse files
Merge #26
26: Make show more terse r=charleskawczynski a=charleskawczynski I've found that working with `DispatchedTuple`s in practice, `show` can be quite verbose. For example, in the README, printing the type alone for 3 entries reads `DispatchedTuple{Tuple{Tuple{Foo,Int64},Tuple{Foo,Int64},Tuple{Bar,Int64}},DispatchedTuples.NoDefaults}`. This PR removes printing `typeof` information in `show`. Co-authored-by: Charles Kawczynski <kawczynski.charles@gmail.com>
2 parents dae8244 + ff6058d commit 911c203

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "DispatchedTuples"
22
uuid = "508c55e1-51b4-41fd-a5ca-7eb0327d070d"
33
authors = ["Charles Kawczynski <kawczynski.charles@gmail.com>"]
4-
version = "0.2.0"
4+
version = "0.2.1"
55

66
[compat]
77
julia = "1.5"

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ julia> struct Bar end;
6767
julia> struct Baz end;
6868

6969
julia> dtup = DispatchedTuple((
70-
Pair(Foo(), 1),
71-
Pair(Foo(), 2),
72-
Pair(Bar(), 3),
73-
))
74-
DispatchedTuple{Tuple{Tuple{Foo,Int64},Tuple{Foo,Int64},Tuple{Bar,Int64}},DispatchedTuples.NoDefaults} with 3 entries:
70+
Pair(Foo(), 1),
71+
Pair(Foo(), 2),
72+
Pair(Bar(), 3),
73+
))
74+
DispatchedTuple with 3 entries:
7575
Foo() => 1
7676
Foo() => 2
7777
Bar() => 3

src/DispatchedTuples.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ show_default(io::IO, dt::DispatchedTuple, ::NoDefaults) = println(io, " default
209209
show_default(io::IO, dt::DispatchedSet, ::NoDefaults) = println(io, " default => error")
210210

211211
function Base.show(io::IO, dt::AbstractDispatchedTuple)
212-
show(io, typeof(dt))
212+
print(io, "$(nameof(typeof(dt)))")
213213
print(io, " with $(length(dt)) entries:")
214214
println(io)
215215
foreach(dt) do tup

0 commit comments

Comments
 (0)