There was inadvertently introduced in #9. It hasn't yet been released though.
On 0.1, ReadOnlyArray has the following behavior:
julia> X = ReadOnlyArray([1, 2])
2-element ReadOnlyArray{Int64, 1, Vector{Int64}}:
1
2
julia> c = copy(X)
2-element Vector{Int64}:
1
2
julia> c .= c .^ 2
2-element Vector{Int64}:
1
4
Which makes ReadOnlyArrays compatible with many libraries that create buffers from the input array. You would store your input data in a ReadOnlyArray, and expect the underlying package to make copies of it and then operate on the copy.
similar works by creating a copy of the parent array, rather than another ReadOnlyArray.
@bkamins @markmbaum
There was inadvertently introduced in #9. It hasn't yet been released though.
On 0.1,
ReadOnlyArray
has the following behavior:Which makes ReadOnlyArrays compatible with many libraries that create buffers from the input array. You would store your input data in a
ReadOnlyArray
, and expect the underlying package to make copies of it and then operate on the copy.similar
works by creating a copy of the parent array, rather than anotherReadOnlyArray
.However, after 0.1, this is broken:
similar
does not make sense as an operation unless you can mutate the elements, so I think this was introduced by mistake in #9.For example, this means that core operations like
copy
will just break:I think this should be reversed to the behavior of 0.1.