I have been looking for a way to output values with their variable name. @show does exactly this, except the output is not as pretty as when using display. Is there a way I can combine both of them and have something like @out var with an output similar to
See also #22253 Use multi-line format in @show which at one point changed @show to use a display-like format, but this was subsequently reverted in #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:
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