Skip to content

Commit 83edaab

Browse files
authored
mention REPL IOContext in pretty-printing docs (#53926)
Fix omission in pretty-printing docs mentioned here: #53678 (comment) (I think these docs were written before `IOContext` existed?) Also fixes a corresponding place in the REPL docs, which mentioned the `IOContext` but omitted `display`. Closes #53678
1 parent 1488da8 commit 83edaab

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

doc/src/manual/types.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1481,8 +1481,8 @@ julia> [Polar(3, 4.0), Polar(4.0,5.3)]
14811481
```
14821482

14831483
where the single-line `show(io, z)` form is still used for an array of `Polar` values. Technically,
1484-
the REPL calls `display(z)` to display the result of executing a line, which defaults to `show(stdout, MIME("text/plain"), z)`,
1485-
which in turn defaults to `show(stdout, z)`, but you should *not* define new [`display`](@ref)
1484+
the REPL calls `display(z)` to display the result `z` of executing a line, which defaults to `show(io, MIME("text/plain"), z)` (where `io` is an [`IOContext`](@ref) wrapper around [`stdout`](@ref)),
1485+
which in turn defaults to `show(io, z)`, but you should *not* define new [`display`](@ref)
14861486
methods unless you are defining a new multimedia display handler (see [Multimedia I/O](@ref Multimedia-I/O)).
14871487

14881488
Moreover, you can also define `show` methods for other MIME types in order to enable richer display

stdlib/REPL/docs/src/index.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ disabled or enabled at will with `REPL.enable_promptpaste(::Bool)`. If it is ena
5757
out by pasting the code block above this paragraph straight into the REPL. This feature does not
5858
work on the standard Windows command prompt due to its limitation at detecting when a paste occurs.
5959

60-
Objects are printed at the REPL using the [`show`](@ref) function with a specific [`IOContext`](@ref).
60+
A non-[`nothing`](@ref) result of executing an expression is displayed by the REPL using the [`show`](@ref) function
61+
with a specific [`IOContext`](@ref) (via [`display`](@ref), which defaults to calling
62+
`show(io, MIME("text/plain"), ans)`, which in turn defaults to `show(io, ans)`).
6163
In particular, the `:limit` attribute is set to `true`.
6264
Other attributes can receive in certain `show` methods a default value if it's not already set,
6365
like `:compact`.

0 commit comments

Comments
 (0)