# \[ANN\]: ZeroDimensionalArrays.jl: zero-dimensional arrays/references/boxes

**URL:** <https://discourse.julialang.org/t/ann-zerodimensionalarrays-jl-zero-dimensional-arrays-references-boxes/128002>\
**Category:** Package Announcements\
**Tags:** package, announcement, array, mutable-structure, ref\
**Created:** [April 12, 2025, 10:17am UTC](https://discourse.julialang.org/t/ann-zerodimensionalarrays-jl-zero-dimensional-arrays-references-boxes/128002 "2025-04-12T10:17:05Z")\
**Posts on this page:** 5\
**Page:** 2

<div class="post-metadata">

**Author:** ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)\
**Post date:** [April 14, 2025, 7:35am UTC](https://discourse.julialang.org/t/ann-zerodimensionalarrays-jl-zero-dimensional-arrays-references-boxes/128002/21 "2025-04-14T07:35:16Z")

</div>

> [@PetrKryslUCSD](#):
>
> This array has exactly one element, but it is not zero-dimensional.
> 
> I find this terminology confusing.

I think it’s similar to the difference between a Vector and a Matrix. A matrix can be NxM, Nx1, or even Nx0, but a vector is constrained to being length 1 in the second dimension, even when it’s empty (to the extent that one can say it has a size in the second dimension at all, but at least it is fixed):

```julia
julia> size(Int[], 1)
0

julia> size(Int[], 2)
1

```

A 0-dimensional array is constrained to always containing exactly one single value, and is therefore similar to a scalar, while a vector can be empty, length 1 or length N.

---

<div class="post-metadata">

**Author:** ![aplavin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aplavin/32/222056_2.png) [@aplavin](https://discourse.julialang.org/u/aplavin)\
**Post date:** [April 14, 2025, 7:41am UTC](https://discourse.julialang.org/t/ann-zerodimensionalarrays-jl-zero-dimensional-arrays-references-boxes/128002/22 "2025-04-14T07:41:12Z")

</div>

> [@mcabbott](#):
>
> But there’s another broadcasting difference, that `Fill` makes purity assumptions. This one I think is a choice, which [FillArrays.jl](https://juliaregistries.github.io/General/packages/redirect_to_repo/FillArrays) does not regard as a bug:

Purity assumption is common and totally makes sense IMO. Eg, among stdlibs:

```julia
julia> using SparseArrays
julia> (_ -> rand()).(spzeros(5)) .+ zeros(5)
5-element SparseVector{Float64, Int64} with 5 stored entries:
  [1] = 0.860252
  [2] = 0.860252
  [3] = 0.860252
  [4] = 0.860252
  [5] = 0.860252

```

---

<div class="post-metadata">

**Author:** ![foobar\_lv2](https://avatars.discourse-cdn.com/v4/letter/f/ee59a6/32.png) [@foobar\_lv2](https://discourse.julialang.org/u/foobar_lv2)\
**Post date:** [April 14, 2025, 9:14am UTC](https://discourse.julialang.org/t/ann-zerodimensionalarrays-jl-zero-dimensional-arrays-references-boxes/128002/23 "2025-04-14T09:14:02Z")

</div>

Can we fix that with [Document Base.RefValue and clarify that this is public API by bbrehm · Pull Request #58101 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/pull/58101) ?

---

<div class="post-metadata">

**Author:** ![nsajko](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nsajko/32/221187_2.png) [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Post date:** [September 19, 2025, 11:39am UTC](https://discourse.julialang.org/t/ann-zerodimensionalarrays-jl-zero-dimensional-arrays-references-boxes/128002/24 "2025-09-19T11:39:55Z")

</div>

ZeroDimensionalArrays.jl v1.1.0 is registered just now. Changes:

- Added another zero-dimensional array type, `ZeroDimArrayInTypeParameter`. It stores its element only in a type parameter.

- For all types except `Box`, the default element type of `Arr(element)` is now the more precise `Type{element}` whenever `element isa Type`. There were no changes to `Box` to prevent breakage, as `Box` supports mutation, which might fail if an element type of `DataType` was replaced with the more precise `Type{T}`.

---

<div class="post-metadata">

**Author:** ![oschulz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oschulz/32/2998_2.png) [@oschulz](https://discourse.julialang.org/u/oschulz)\
**Post date:** [October 15, 2025, 3:33pm UTC](https://discourse.julialang.org/t/ann-zerodimensionalarrays-jl-zero-dimensional-arrays-references-boxes/128002/25 "2025-10-15T15:33:59Z")

</div>

Thanks for this package @nsajko ! I had been looking for an immutable (and isbits with an isbits value) array type like `ZeroDimArray` for a while now.

[Previous page](https://discourse.julialang.org/t/ann-zerodimensionalarrays-jl-zero-dimensional-arrays-references-boxes/128002.md?page=1)
