@@ -358,14 +358,20 @@ function show_circular(io::IOContext, @nospecialize(x))
358
358
end
359
359
360
360
"""
361
- show(x)
361
+ show([io::IO = stdout], x)
362
362
363
- Write an informative text representation of a value to the current output stream. New types
364
- should overload `show(io::IO, x)` where the first argument is a stream. The representation used
365
- by `show` generally includes Julia-specific formatting and type information.
363
+ Write a text representation of a value `x` to the output stream `io`. New types `T`
364
+ should overload `show(io::IO, x::T)`. The representation used
365
+ by `show` generally includes Julia-specific formatting and type information, and should
366
+ be parseable Julia code when possible.
366
367
367
368
[`repr`](@ref) returns the output of `show` as a string.
368
369
370
+ To customize human-readable text output for objects of type `T`, define
371
+ `show(io::IO, ::MIME"text/plain", ::T)` instead. To customize how objects
372
+ are shown inside containers, check the `:compact` [`IOContext`](@ref)
373
+ property of `io`.
374
+
369
375
See also [`print`](@ref), which writes un-decorated representations.
370
376
371
377
# Examples
@@ -376,10 +382,10 @@ julia> print("Hello World!")
376
382
Hello World!
377
383
```
378
384
"""
379
- show (x) = show (stdout :: IO , x)
380
-
381
385
show (io:: IO , @nospecialize (x)) = show_default (io, x)
382
386
387
+ show (x) = show (stdout :: IO , x)
388
+
383
389
# avoid inferring show_default on the type of `x`
384
390
show_default (io:: IO , @nospecialize (x)) = _show_default (io, inferencebarrier (x))
385
391
0 commit comments