Skip to content

Commit 9a310d2

Browse files
authored
rename ZeroDimensionalArrayImmutable to ZeroDimArray (#16)
Fixes #7
1 parent 9ae5a45 commit 9a310d2

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
A small software package for the Julia programming language providing zero-dimensional array types. `Ref`-killer.
1010

1111
Exports three zero-dimensional subtypes of `AbstractArray`:
12-
* `ZeroDimensionalArrayImmutable`
12+
* `ZeroDimArray`
1313
* declared with `struct`, not with `mutable struct`
1414
* does not support `setfield!`, or mutating the element otherwise
1515
* `isbits` when the element is `isbits`
@@ -45,11 +45,11 @@ The motivation for creating this package is:
4545
* https://github.com/JuliaLang/julia/issues/40369
4646
* https://discourse.julialang.org/t/dynamic-immutable-type/127168
4747
* to provide a wrapper type for treating a value as a scalar in broadcasting, something `Ref` is often used for:
48-
* `ZeroDimensionalArrayImmutable` can be a good replacement:
48+
* `ZeroDimArray` can be a good replacement:
4949
```julia-repl
5050
julia> using ZeroDimensionalArrays
5151
52-
julia> isa.(ZeroDimensionalArrayImmutable([1,2,3]), [Array, Dict, Int])
52+
julia> isa.(ZeroDimArray([1,2,3]), [Array, Dict, Int])
5353
3-element BitVector:
5454
1
5555
0

src/ZeroDimensionalArrays.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
module ZeroDimensionalArrays
22

33
export
4-
ZeroDimensionalArrayImmutable,
4+
ZeroDimArray,
55
Box,
66
BoxConstField
77

8-
struct ZeroDimensionalArrayImmutable{T} <: AbstractArray{T, 0}
8+
struct ZeroDimArray{T} <: AbstractArray{T, 0}
99
v::T
1010
global function new_zero_dimensional_array_immutable(::Type{T}, v) where {T}
1111
new{T}(v)
@@ -30,13 +30,13 @@ mutable struct BoxConstField{T} <: AbstractArray{T, 0}
3030
end
3131

3232
const ZeroDimensionalArray = Union{
33-
ZeroDimensionalArrayImmutable,
33+
ZeroDimArray,
3434
Box,
3535
BoxConstField,
3636
}
3737

3838
function type_to_constructor_function(::Type{T}) where {T <: ZeroDimensionalArray}
39-
if T <: ZeroDimensionalArrayImmutable
39+
if T <: ZeroDimArray
4040
new_zero_dimensional_array_immutable
4141
elseif T <: Box
4242
new_zero_dimensional_array_mutable
@@ -100,7 +100,7 @@ function convert_from_other_array(::Type{Arr}, a::AbstractArray{<:Any, 0}) where
100100
end
101101

102102
for Arr (
103-
ZeroDimensionalArrayImmutable,
103+
ZeroDimArray,
104104
Box,
105105
BoxConstField,
106106
)

test/runtests.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ using Aqua: Aqua
99

1010
@testset "all array types joined" begin
1111
for Arr (
12-
ZeroDimensionalArrayImmutable,
12+
ZeroDimArray,
1313
Box,
1414
BoxConstField,
1515
)
@@ -37,10 +37,10 @@ using Aqua: Aqua
3737
end
3838

3939
@testset "each array type on its own" begin
40-
@testset "`ZeroDimensionalArrayImmutable`" begin
41-
@test @isdefined ZeroDimensionalArrayImmutable
42-
@test !ismutabletype(ZeroDimensionalArrayImmutable)
43-
@test isbitstype(ZeroDimensionalArrayImmutable{Float64})
40+
@testset "`ZeroDimArray`" begin
41+
@test @isdefined ZeroDimArray
42+
@test !ismutabletype(ZeroDimArray)
43+
@test isbitstype(ZeroDimArray{Float64})
4444
end
4545
@testset "`Box`" begin
4646
@test @isdefined Box

0 commit comments

Comments
 (0)