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

extend write docstring #30677

Merged
merged 3 commits into from
Jan 23, 2019
Merged

extend write docstring #30677

merged 3 commits into from
Jan 23, 2019

Conversation

jw3126
Copy link
Contributor

@jw3126 jw3126 commented Jan 10, 2019

base/io.jl Outdated
@@ -176,6 +176,19 @@ julia> write(io, "Sometimes those members") + write(io, " write documentation.")
julia> String(take!(io))
"Sometimes those members write documentation."
```
Note that in general the value needs to be wrapped in a `Ref`, but for several basic types this can be skipped as above.
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this makes it sound like Ref is needed more often than it really is. In practice, most/all types with a sensible binary representation have direct write methods. In fact I'm not even sure this use of Ref is intended; it's buggy and will sometimes write references as their address.

Maybe I'd say "User-defined plain-data types without write methods can be written when wrapped in a Ref".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay I changed it. I think there should be a default way to write bitstypes in Base. Whether it is via write(io, Ref(obj)) or another function I don't have a strong opinion about.

@kshyatt kshyatt added domain:docs This change adds or pertains to documentation domain:io Involving the I/O subsystem: libuv, read, write, etc. labels Jan 13, 2019
@jw3126
Copy link
Contributor Author

jw3126 commented Jan 20, 2019

Can somebody rerun appveyor?

@JeffBezanson JeffBezanson merged commit e87b19b into JuliaLang:master Jan 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:docs This change adds or pertains to documentation domain:io Involving the I/O subsystem: libuv, read, write, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants