@@ -6662,28 +6662,32 @@ Return, but do not print, the time elapsed since the last [`tic`](:func:`tic`).
66626662toq
66636663
66646664"""
6665- writemime (stream, mime, x)
6665+ show (stream, mime, x)
66666666
6667- The `display` functions ultimately call `writemime ` in order to write an object `x` as a
6667+ The `display` functions ultimately call `show ` in order to write an object `x` as a
66686668given `mime` type to a given I/O `stream` (usually a memory buffer), if possible. In order
66696669to provide a rich multimedia representation of a user-defined type `T`, it is only necessary
6670- to define a new `writemime ` method for `T`, via: `writemime (stream, ::MIME"mime", x::T) = ...`,
6670+ to define a new `show ` method for `T`, via: `show (stream, ::MIME"mime", x::T) = ...`,
66716671where `mime` is a MIME-type string and the function body calls `write` (or similar) to write
66726672that representation of `x` to `stream`. (Note that the `MIME""` notation only supports
66736673literal strings; to construct `MIME` types in a more flexible manner use
66746674`MIME{Symbol("")}`.)
66756675
66766676For example, if you define a `MyImage` type and know how to write it to a PNG file, you
6677- could define a function `writemime (stream, ::MIME"image/png", x::MyImage) = ...` to allow
6677+ could define a function `show (stream, ::MIME"image/png", x::MyImage) = ...` to allow
66786678your images to be displayed on any PNG-capable `Display` (such as IJulia). As usual, be sure
6679- to `import Base.writemime ` in order to add new methods to the built-in Julia function
6680- `writemime `.
6679+ to `import Base.show ` in order to add new methods to the built-in Julia function
6680+ `show `.
66816681
66826682Technically, the `MIME"mime"` macro defines a singleton type for the given `mime` string,
66836683which allows us to exploit Julia's dispatch mechanisms in determining how to display objects
66846684of any given type.
6685+
6686+ The default MIME type is `MIME"text/plain"`. There is a fallback definition for `text/plain`
6687+ output that calls `show` with 2 arguments. Therefore, this case should be handled by
6688+ defining a 2-argument `show` method.
66856689"""
6686- writemime
6690+ show (stream, mime, x)
66876691
66886692"""
66896693 mean!(r, v)
@@ -7303,7 +7307,7 @@ Write an informative text representation of a value to the current output stream
73037307should overload `show(io, x)` where the first argument is a stream. The representation used
73047308by `show` generally includes Julia-specific formatting and type information.
73057309"""
7306- show
7310+ show (x)
73077311
73087312"""
73097313 @allocated
@@ -7981,8 +7985,8 @@ rethrow
79817985 reprmime(mime, x)
79827986
79837987Returns an `AbstractString` or `Vector{UInt8}` containing the representation of `x` in the
7984- requested `mime` type, as written by `writemime ` (throwing a `MethodError` if no appropriate
7985- `writemime ` is available). An `AbstractString` is returned for MIME types with textual
7988+ requested `mime` type, as written by `show ` (throwing a `MethodError` if no appropriate
7989+ `show ` is available). An `AbstractString` is returned for MIME types with textual
79867990representations (such as `"text/html"` or `"application/postscript"`), whereas binary data
79877991is returned as `Vector{UInt8}`. (The function `istextmime(mime)` returns whether or not Julia
79887992treats a given `mime` type as text.)
@@ -8375,7 +8379,7 @@ showall
83758379
83768380Returns a boolean value indicating whether or not the object `x` can be written as the given
83778381`mime` type. (By default, this is determined automatically by the existence of the
8378- corresponding `writemime ` function for `typeof(x)`.)
8382+ corresponding `show ` function for `typeof(x)`.)
83798383"""
83808384mimewritable
83818385
0 commit comments