Closed
Description
openedon Sep 13, 2018
help?> copy!
search: copy! copyto! circcopy! unsafe_copyto! copy copysign deepcopy
copy!(dst, src)
In-place copy of src into dst. After the call to copy!, dst must be left
equal to src, otherwise an error is thrown; this function appropriately
resizes dst if necessary. See also copyto!.
Well, sounds convenient for a preallocated dst::Vector{T}, src::AbstractVector{T}
. Alas,
julia> methods(copy!)
# 4 methods for generic function "copy!":
[1] copy!(dst::Random.MersenneTwister, src::Random.MersenneTwister) in Random at /build/julia/src/julia/usr/share/julia/stdlib/v1.0/Random/src/RNGs.jl:142
[2] copy!(dst::Random.DSFMT.DSFMT_state, src::Random.DSFMT.DSFMT_state) in Random.DSFMT at /build/julia/src/julia/usr/share/julia/stdlib/v1.0/Random/src/DSFMT.jl:37
[3] copy!(a::LibGit2.GitCredential, b::LibGit2.GitCredential) in LibGit2 at /build/julia/src/julia/usr/share/julia/stdlib/v1.0/LibGit2/src/gitcredential.jl:83
[4] copy!(dest::BitSet, src::BitSet) in Base at bitset.jl:58
I guess the docs went out of sync and copy!
was deprecated for ( length(dst)==length(src) || resize!(dst, length(src)) ); copyto!(dst, src)
at some point? I'm not sure whether the documented functionality really needs to exist, but either way, reality and doc should match.
For the next release, if copy!
does not come back, can we rename the other copy!
methods to something less prominent then? The BitSet!
copy!
probably needs to stay for now, since it is in base and would be breaking?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment