# Combining @show with display

**URL:** <https://discourse.julialang.org/t/combining-show-with-display/84522>\
**Category:** General Usage\
**Tags:** display, show\
**Created:** [July 20, 2022, 10:03am UTC](https://discourse.julialang.org/t/combining-show-with-display/84522 "2022-07-20T10:03:46Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [July 20, 2022, 11:57am UTC](https://discourse.julialang.org/t/combining-show-with-display/84522/2 "2022-07-20T11:57:40Z")

</div>

This has certainly been proposed. See [#15820 Define macro `@display`](https://github.com/JuliaLang/julia/issues/15820) and the discussion thread [How to print arrays inside functions? - #5 by antoine-levitt](https://discourse.julialang.org/t/how-to-print-arrays-inside-functions/4091/5) … it wouldn’t be crazy to add something like this, but no one has done it yet.

See also [#22253 Use multi-line format in `@show`](https://github.com/JuliaLang/julia/pull/22253) which at one point changed `@show` to use a `display`-like format, but this was subsequently reverted in [#25849](https://github.com/JuliaLang/julia/pull/25849) because it broke the `repr` property that you could cut-and-paste `@show` results into code.

You could always define your own macro based on the code in #22253, of course:

```julia
macro myshow(exs...)
    blk = Expr(:block)
    for ex in exs
        push!(blk.args, :(print($(sprint(Base.show_unquoted,ex)*" = "))))
        push!(blk.args, :(show(stdout, "text/plain", begin value=$(esc(ex)) end)))
        push!(blk.args, :(println()))
    end
    isempty(exs) || push!(blk.args, :value)
    return blk
end

```

which gives

```julia
julia> @show rand(5);
rand(5) = [0.15242788991869327, 0.822593384182898, 0.24466669272136954, 0.9124861334431887, 0.6474094076037362]

julia> @myshow rand(5);
rand(5) = 5-element Vector{Float64}:
 0.2430428495428918
 0.556988929839062
 0.9504355130227148
 0.07313670570961417
 0.7135984118032906

```

---

_[View the full topic](https://discourse.julialang.org/t/combining-show-with-display/84522)._
