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

Semantic versioning #16

Closed
juliohm opened this issue Sep 20, 2021 · 5 comments
Closed

Semantic versioning #16

juliohm opened this issue Sep 20, 2021 · 5 comments

Comments

@juliohm
Copy link

juliohm commented Sep 20, 2021

This package is a dependency in Meshes.jl and we recently started having issues with a non-working resize! function. I think this is probably related to semantic versioning misunderstanding...

When you updated from 1.1 to 1.2 to 1.3 you adopted the following rule? https://semver.org/spec/v2.0.0.html#spec-item-7

Our tests are failing now downstream. Could you please double check and help fix the issues?

Also, I reiterate the importance of placing this package in an organization where multiple members can help maintain and double check these things before submitting disruptive new releases.

@serenity4
Copy link

The bug in question can be reproduced in 1.3.0:

julia> using CircularArrays

julia> vec = CircularVector([1, 2])
2-element CircularVector(::Vector{Int64}):
 1
 2

julia> push!(vec, 3)
ERROR: MethodError: no method matching resize!(::CircularVector{Int64, Vector{Int64}}, ::Int64)
Closest candidates are:
  resize!(::Vector{T} where T, ::Integer) at array.jl:1101
  resize!(::BitVector, ::Integer) at bitarray.jl:810
Stacktrace:
 [1] _append!(a::CircularVector{Int64, Vector{Int64}}, #unused#::Base.HasLength, iter::Tuple{Int64})
   @ Base ./array.jl:989
 [2] append!(a::CircularVector{Int64, Vector{Int64}}, iter::Tuple{Int64})
   @ Base ./array.jl:981
 [3] push!(a::CircularVector{Int64, Vector{Int64}}, iter::Int64)
   @ Base ./array.jl:982
 [4] top-level scope
   @ REPL[7]:1

but can also be reproduced in 1.1.0. I am not sure why it worked before on Meshes and why it no longer does. Anyway, the problem seems to come from resize! not being forwarded to the wrapped array.

@serenity4
Copy link

I see that pushing/appending to a circular array does not work and is even tested for not working. The problem seems to come deeper from a change in behavior on broadcasting, where the result of a broadcast yields a value of type CircularArray whereas before it would produce a vector.

@Vexatos
Copy link
Owner

Vexatos commented Sep 21, 2021

Calling push! on a CircularVector is indeed supposed to not work. Here is the test case for it. For the same reason, resize! was never supposed to work. The reason for this decision when I made this package was that being able to resize a circular array would make the circular behaviour no longer trivially predictable. It's not really certain whether push! should add elements to the start or end of such an array as, conceptually, it should not be possible to determine its start or end at all (superficially). You can of course always resize the parent() of the circular array if you really need to, which is probably the recommended way to do it anyway.

1.3.0 introduced a fix to broadcast behaviour where broadcasting over a circular array would produce a circular array where applicable (#15). Broadcasting not returning a circular array was a bug and relying on the type conversion during a broadcast operation is something that should arguably be fixed in the code downstream. The update introduced a larger number of methods, so if any regressions occur, be sure to let me know. However, without any reproduction steps or examples, I cannot do much.

@serenity4
Copy link

Indeed we found that we were relying on broadcasting giving a vector, which was a happy coincidence that made the code work but definitely not a better behavior. The rationale behind not allowing push! on a CircularVector makes total sense, using parent seems to do the trick.

@juliohm I think we can close this issue.

@juliohm
Copy link
Author

juliohm commented Sep 21, 2021

Thank you all, let's close the issue and try to fix it downstream then. 👍🏽

@juliohm juliohm closed this as completed Sep 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants