Skip to content

Commit 92d3702

Browse files
Update repr docstring to hint what it stands for. (#56761)
- Change `repr` docstring from "Create a string from any value ..." to "Create a string representation of any value ...". - Document that it typically emits parseable Julia code --------- Co-authored-by: Ian Butterworth <[email protected]>
1 parent d269d7d commit 92d3702

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

base/strings/io.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,9 @@ print(io::IO, s::Union{String,SubString{String}}) = (write(io, s); nothing)
250250
"""
251251
repr(x; context=nothing)
252252
253-
Create a string from any value using the 2-argument `show(io, x)` function.
253+
Create a string representation of any value using the 2-argument `show(io, x)` function,
254+
which aims to produce a string that is parseable Julia code, where possible.
255+
i.e. `eval(Meta.parse(repr(x))) == x` should hold true.
254256
You should not add methods to `repr`; define a [`show`](@ref) method instead.
255257
256258
The optional keyword argument `context` can be set to a `:key=>value` pair, a

0 commit comments

Comments
 (0)