Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mention REPL IOContext in pretty-printing docs #53926

Merged
merged 6 commits into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions doc/src/manual/types.md
Original file line number Diff line number Diff line change
Expand Up @@ -1481,8 +1481,8 @@ julia> [Polar(3, 4.0), Polar(4.0,5.3)]
```

where the single-line `show(io, z)` form is still used for an array of `Polar` values. Technically,
the REPL calls `display(z)` to display the result of executing a line, which defaults to `show(stdout, MIME("text/plain"), z)`,
which in turn defaults to `show(stdout, z)`, but you should *not* define new [`display`](@ref)
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)),
which in turn defaults to `show(io, z)`, but you should *not* define new [`display`](@ref)
methods unless you are defining a new multimedia display handler (see [Multimedia I/O](@ref Multimedia-I/O)).

Moreover, you can also define `show` methods for other MIME types in order to enable richer display
Expand Down
4 changes: 3 additions & 1 deletion stdlib/REPL/docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ disabled or enabled at will with `REPL.enable_promptpaste(::Bool)`. If it is ena
out by pasting the code block above this paragraph straight into the REPL. This feature does not
work on the standard Windows command prompt due to its limitation at detecting when a paste occurs.

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