@@ -2,8 +2,8 @@ module ZeroDimensionalArrays
2
2
3
3
export
4
4
ZeroDimensionalArrayImmutable,
5
- ZeroDimensionalArrayMutable ,
6
- ZeroDimensionalArrayMutableConstField
5
+ Box ,
6
+ BoxConstField
7
7
8
8
struct ZeroDimensionalArrayImmutable{T} <: AbstractArray{T, 0}
9
9
v:: T
@@ -12,7 +12,7 @@ struct ZeroDimensionalArrayImmutable{T} <: AbstractArray{T, 0}
12
12
end
13
13
end
14
14
15
- mutable struct ZeroDimensionalArrayMutable {T} <: AbstractArray{T, 0}
15
+ mutable struct Box {T} <: AbstractArray{T, 0}
16
16
v:: T
17
17
global function new_zero_dimensional_array_mutable (:: Type{T} , v) where {T}
18
18
new {T} (v)
@@ -22,7 +22,7 @@ mutable struct ZeroDimensionalArrayMutable{T} <: AbstractArray{T, 0}
22
22
end
23
23
end
24
24
25
- mutable struct ZeroDimensionalArrayMutableConstField {T} <: AbstractArray{T, 0}
25
+ mutable struct BoxConstField {T} <: AbstractArray{T, 0}
26
26
const v:: T
27
27
global function new_zero_dimensional_array_mutable_const_field (:: Type{T} , v) where {T}
28
28
new {T} (v)
31
31
32
32
const ZeroDimensionalArray = Union{
33
33
ZeroDimensionalArrayImmutable,
34
- ZeroDimensionalArrayMutable ,
35
- ZeroDimensionalArrayMutableConstField ,
34
+ Box ,
35
+ BoxConstField ,
36
36
}
37
37
38
38
function type_to_constructor_function (:: Type{T} ) where {T <: ZeroDimensionalArray }
39
39
if T <: ZeroDimensionalArrayImmutable
40
40
new_zero_dimensional_array_immutable
41
- elseif T <: ZeroDimensionalArrayMutable
41
+ elseif T <: Box
42
42
new_zero_dimensional_array_mutable
43
- elseif T <: ZeroDimensionalArrayMutableConstField
43
+ elseif T <: BoxConstField
44
44
new_zero_dimensional_array_mutable_const_field
45
45
else
46
46
throw (ArgumentError (" no such constructor function" ))
@@ -63,7 +63,7 @@ function Base.getindex(a::ZeroDimensionalArray)
63
63
a. v
64
64
end
65
65
66
- function Base. setindex! (a:: ZeroDimensionalArrayMutable , x)
66
+ function Base. setindex! (a:: Box , x)
67
67
a. v = x
68
68
end
69
69
101
101
102
102
for Arr ∈ (
103
103
ZeroDimensionalArrayImmutable,
104
- ZeroDimensionalArrayMutable ,
105
- ZeroDimensionalArrayMutableConstField ,
104
+ Box ,
105
+ BoxConstField ,
106
106
)
107
107
@eval begin
108
108
function Base. convert (:: Type{$Arr} , a:: AbstractArray{<:Any, 0} )
@@ -120,7 +120,7 @@ for Arr ∈ (
120
120
end
121
121
end
122
122
123
- function ZeroDimensionalArrayMutable {T} () where {T}
123
+ function Box {T} () where {T}
124
124
new_zero_dimensional_array_mutable_undef (T)
125
125
end
126
126
136
136
# ```
137
137
138
138
# https://github.com/JuliaLang/julia/issues/51753
139
- if isdefined (Base, :dataids ) && hasmethod (Base. dataids, Tuple{ZeroDimensionalArrayMutable {Float32}})
139
+ if isdefined (Base, :dataids ) && hasmethod (Base. dataids, Tuple{Box {Float32}})
140
140
function Base. dataids (a:: ZeroDimensionalArray )
141
141
Base. dataids (only (a))
142
142
end
0 commit comments