Skip to content

Conversation

@matthieugomez
Copy link
Contributor

@matthieugomez matthieugomez commented Jun 6, 2017

@show now display objects using the multi-line format.

This pull request fixes #15820 and this Discourse issue. Replaces pull request #22244

@ararslan ararslan added display and printing Aesthetics and correctness of printed representations of objects. needs tests Unit tests are required for this change labels Jun 6, 2017
`@show` now uses a multi-line format (i.e. calls show(STDOUT,
“text/plain”, …).

Fix #15820 and this [Discourse
issue](https://discourse.julialang.org/t/how-to-print-arrays-inside-func
tions/4091).

Also replaces pull request #22244
test/show.jl Outdated

# Test @show
fname = tempname()
f = open(fname, "w")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be good to use do-blocks for some of these, including the redirection so they get put back when finished

Copy link
Contributor Author

@matthieugomez matthieugomez Jun 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I've pushed a new commit doing that. Was it why the tests did not pass?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks like this changes some output that test/test.jl is comparing against

@matthieugomez
Copy link
Contributor Author

Tests are added and pass.

@tkelman
Copy link
Contributor

tkelman commented Jun 7, 2017

(should be squashed, on merge if not before)

@KristofferC KristofferC merged commit fe2d49f into JuliaLang:master Jun 7, 2017
@matthieugomez
Copy link
Contributor Author

Thanks!

@StefanKarpinski
Copy link
Member

I think we should consider reverting this. @show is particularly useful for debugging since you can often cut-and-paste the output to recreate the values but this change makes that far less common.

@iamed2
Copy link
Contributor

iamed2 commented Jan 31, 2018

I don't like how this turned out, for two reasons:

  1. @show x now uses a different method than show(x) to display the result
  2. @show x was helpful for doctesting for loops in IterTools.jl, but the doctest output would now be so ugly and long that we'll have to change it

I propose bringing back #22244 (@display macro)

Julia 0.6:

julia> show(x)
[1, 2, 3]
julia> show(STDOUT, "text/plain", x)
3-element Array{Int64,1}:
 1
 2
 3
julia> @show x;
x = [1, 2, 3]

Julia 0.7:

julia> show(x)
[1, 2, 3]
julia> show(STDOUT, "text/plain", x)
3-element Array{Int64,1}:
 1
 2
 3
julia> @show x;
x = 3-element Array{Int64,1}:
 1
 2
 3

@StefanKarpinski StefanKarpinski added the triage This should be discussed on a triage call label Jan 31, 2018
@StefanKarpinski StefanKarpinski added triage This should be discussed on a triage call and removed triage This should be discussed on a triage call labels Feb 1, 2018
@StefanKarpinski
Copy link
Member

Triage agrees: let's revert this.

@StefanKarpinski StefanKarpinski removed the triage This should be discussed on a triage call label Feb 1, 2018
ararslan added a commit that referenced this pull request Feb 1, 2018
This reverts commit fe2d49f.

The change in #22253 essentially broke the round-trippable-ness of using
`at-show` with arrays. It was decided that the change should simply be
reverted.
ararslan added a commit that referenced this pull request Feb 1, 2018
This reverts commit fe2d49f.

The change in #22253 essentially broke the round-trippable-ness of using
`at-show` with arrays. It was decided that the change should simply be
reverted.
JeffBezanson pushed a commit that referenced this pull request Feb 2, 2018
This reverts commit fe2d49f.

The change in #22253 essentially broke the round-trippable-ness of using
`at-show` with arrays. It was decided that the change should simply be
reverted.
@knuesel knuesel mentioned this pull request May 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

display and printing Aesthetics and correctness of printed representations of objects. needs tests Unit tests are required for this change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Define macro @display

7 participants