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

fix #6466, deprecate write on non-isbits arrays #22941

Merged
merged 1 commit into from
Jul 28, 2017
Merged

Conversation

JeffBezanson
Copy link
Member

No description provided.

@JeffBezanson JeffBezanson added deprecation This change introduces or involves a deprecation io Involving the I/O subsystem: libuv, read, write, etc. labels Jul 24, 2017
@tkelman
Copy link
Contributor

tkelman commented Jul 24, 2017

How will these change when this is removed? The depwarn and invoke calls replaced by errors?

@JeffBezanson
Copy link
Member Author

Yes.

@vtjnash
Copy link
Member

vtjnash commented Jul 25, 2017

This feels a bit wrong, since I think in most cases we've found that dispatching on eltype is annoying / throwing unnecessary errors is painful. In particular, we've generally tended towards f(Any[x, y]) being the same as f(T[x, y]) for all T, and letting the homogeneity of the elements themselves (or lack thereof) define the behavior. But I realize the current behavior isn't entirely consistent either (sometimes opting for direct unsafe_write copies over the more pedantic dispatch loop over all elements), so I'm not strongly opposed either.

@JeffBezanson
Copy link
Member Author

Yes, it's slightly unsatisfying. But the concept is that write is only valid on objects with a "canonical binary representation", and that the direct argument to write (not values inside it) should determine the data format. Otherwise we're stuck with the dispatch loop for all but a fixed set of known types.

Come to think of it the method write(s::IO, x::Ref{T}) where {T} also needs this check; currently write(io, Ref((:a,:b))) writes garbage.

Also remove an unnecessary method, and generalize a `write` method
for `SubArray` from `::IOStream` to `::IO`.
@JeffBezanson JeffBezanson merged commit fc10c8b into master Jul 28, 2017
@JeffBezanson JeffBezanson deleted the jb/fix6466 branch July 28, 2017 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deprecation This change introduces or involves a deprecation io Involving the I/O subsystem: libuv, read, write, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants