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

String interpolation doc should mention show #21982

Closed
cstjean opened this issue May 20, 2017 · 2 comments
Closed

String interpolation doc should mention show #21982

cstjean opened this issue May 20, 2017 · 2 comments
Labels
docs This change adds or pertains to documentation

Comments

@cstjean
Copy link
Contributor

cstjean commented May 20, 2017

The docs say "Both concatenation and string interpolation call string() to convert objects into string form." but unless I'm mistaken, that's not true:

julia> immutable Blag end

julia> Base.string(::Blag) = "hoy"

julia> "jo $(Blag())"
"jo Blag()"

AFAICT the proper way to get custom printing is to overload show. If that's correct, I can make a PR.

@yuyichao
Copy link
Contributor

The doc is correct.

julia> struct Blag end

julia> Base.string(a::String, b::Blag) = "hoy"

julia> "jo $(Blag())"
"hoy"

It can certainly be clarified if you find it confusing.

@yuyichao yuyichao added the docs This change adds or pertains to documentation label May 20, 2017
@yuyichao
Copy link
Contributor

Link updated, doc issue still applies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs This change adds or pertains to documentation
Projects
None yet
Development

No branches or pull requests

2 participants