-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Problem with generic copyto! #45125
Comments
Since |
That is why I opened it as an issue not a PR. However, as you will see in this PR in generic code users could assume that |
I would say that julia> copyto!(x, y)
2-element Vector{String}:
#undef
#undef is the bug. There is (almost) never a case where you can undefine values that have once been defined. |
Since Perhaps a check could be added in the
|
Related: #36564 |
bump - for my purposes I am OK with any behavior as long as it is clear what contract |
I believe this was added for a use case in the compiler. I would prefer the compiler to use some different approach if possible, and roll this back, since it is unnerving for it to be inconsistent like this. |
The OP now works on Julia v1.11.0-beta2: julia> x = view(["A", "B"], 1:2)
2-element view(::Vector{String}, 1:2) with eltype String:
"A"
"B"
julia> y = Vector{String}(undef, 2)
2-element Vector{String}:
#undef
#undef
julia> copyto!(x, y)
2-element view(::Vector{String}, 1:2) with eltype String:
#undef
#undef |
not sure I would use the word "works", as this seems worse behavior than before to me of course |
This seems to have been a deliberate choice: #51760 |
Fixed in #51760 |
Broken by #54332 |
The issue is:
The reason is
julia/base/abstractarray.jl
Line 1039 in 6026b5f
If I understand the intention correctly this is a bug in
copyto!
as e.g.works.
The text was updated successfully, but these errors were encountered: