# \[ANN\] Dimensions.jl, a library for accessing the scalar dimensions of structured types

**URL:** https://discourse.julialang.org/t/ann-dimensions-jl-a-library-for-accessing-the-scalar-dimensions-of-structured-types/136935
**Category:** Package Announcements
**Created:** [April 30, 2026, 5:59pm UTC](https://discourse.julialang.org/t/ann-dimensions-jl-a-library-for-accessing-the-scalar-dimensions-of-structured-types/136935 "2026-04-30T17:59:37Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![tuckermcclure](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tuckermcclure/32/1187_2.png) [@tuckermcclure](https://discourse.julialang.org/u/tuckermcclure)
#### Post date: [April 30, 2026, 5:59pm UTC](https://discourse.julialang.org/t/ann-dimensions-jl-a-library-for-accessing-the-scalar-dimensions-of-structured-types/136935/1 "2026-04-30T17:59:37Z")

</div>

Hi all,

I’d like to announce a new package called Dimensions whose purpose is to make it easy to define and access a type’s “dimensions” (e.g., a Position type with `x`, `y`, and `z` fields has 3 dimensions). This is useful when you need to break arbitrary structured types “all the way down to the scalars.” Please see the readme here:

> **[GitHub - Gradient-Aerospace/Dimensions.jl: A Julia package for defining and working with a...](https://github.com/Gradient-Aerospace/Dimensions.jl)**
>
> A Julia package for defining and working with a type's scalar dimensions.

I hope this package establishes a pattern folks find useful, such that Dimensions might become a common way for defining this type of behavior.

I have registered this with the General registry, and it’s in the 3-day waiting period for new packages. @goerz left a comment there suggesting that I post here _before_ it’s actually available to see if folks objected to the name, since the name is so general. There are certainly other viable names, but is the name “Dimensions” a problem for anyone? I have benefitted substantially from the Julia ecosystem and don’t want to make problems for folks. 🙂

For reference, [here is the PR into the General registry](https://github.com/JuliaRegistries/General/pull/154359).

---

<div class="post-metadata">

### Author: ![jd-foster](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jd-foster/32/35824_2.png) [@jd-foster](https://discourse.julialang.org/u/jd-foster)
#### Post date: [May 1, 2026, 1:26am UTC](https://discourse.julialang.org/t/ann-dimensions-jl-a-library-for-accessing-the-scalar-dimensions-of-structured-types/136935/2 "2026-05-01T01:26:10Z")

</div>

Hi Tucker,  
Looks like this package nicely addresses a common problem in practice.

I also find that “Dimensions” might be too broad name for the scope of the package. Could I suggest one alternative, “StructDimensions”, which would fit with the existing theme of packages such as “StructArrays”, “StructEquality” and the like. All the best.

---

<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: [May 1, 2026, 2:21am UTC](https://discourse.julialang.org/t/ann-dimensions-jl-a-library-for-accessing-the-scalar-dimensions-of-structured-types/136935/3 "2026-05-01T02:21:53Z")

</div>

> [@tuckermcclure](#):
>
> This is useful when you need to break arbitrary structured types “all the way down to the scalars.”

There’s a pretty generic

```julia-auto
using AccessorsExtra

vals = getall(yourobj, RecursiveOfType(Real))

```

It can even go in the other direction, `setall(yourobj, RecursiveOfType(Real), vals)`.

---

<div class="post-metadata">

### Author: ![tuckermcclure](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tuckermcclure/32/1187_2.png) [@tuckermcclure](https://discourse.julialang.org/u/tuckermcclure)
#### Post date: [May 1, 2026, 4:38pm UTC](https://discourse.julialang.org/t/ann-dimensions-jl-a-library-for-accessing-the-scalar-dimensions-of-structured-types/136935/4 "2026-05-01T16:38:35Z")

</div>

> [@jd-foster](#):
>
> Could I suggest one alternative, “StructDimensions”, which would fit with the existing theme of packages such as “StructArrays”, “StructEquality” and the like.

Hi @jd-foster. Thanks. I like that “StructDimensions” tries in with the Struct\* ecosystem. That said, it’s not always about structured information. E.g., this works on SVector from StaticArrays (sure, there’s a `struct` involved in its definition, but nobody says “it works on structs like SVector”).

I would suggest “TypeDimensions”, but the dimensions aren’t always encoded in the type (e.g., a Vector’s dimensions are not available from the type). Seems misleading.

Counter-proposal: ScalarDimensions.jl. That name makes it clearer that this is about “getting down the scalars” rather than other uses of the word “dimensions” like “array dimensions”.

What do you think?

---

<div class="post-metadata">

### Author: ![tuckermcclure](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tuckermcclure/32/1187_2.png) [@tuckermcclure](https://discourse.julialang.org/u/tuckermcclure)
#### Post date: [May 1, 2026, 4:45pm UTC](https://discourse.julialang.org/t/ann-dimensions-jl-a-library-for-accessing-the-scalar-dimensions-of-structured-types/136935/5 "2026-05-01T16:45:01Z")

</div>

Thanks, @aplavin. I did not know about AccessorsExtra! That’s an interesting alternative.

---

<div class="post-metadata">

### Author: ![Benny](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@Benny](https://discourse.julialang.org/u/Benny)
#### Post date: [May 1, 2026, 4:48pm UTC](https://discourse.julialang.org/t/ann-dimensions-jl-a-library-for-accessing-the-scalar-dimensions-of-structured-types/136935/6 "2026-05-01T16:48:10Z")

</div>

The direct support for `StaticArrays`, which are somewhere between scalars or arrays, and `AbstractVector` (how does a dynamic array contribute to a type’s dimensions?) gives me pause about `ScalarDimensions`. I think a broader sense of “composite type” could work, but Julia uses that term for `struct` so there would be confusion.

If dynamic array elements don’t actually factor into the dimensions, maybe `StaticDimensions`. Or maybe you could dodge strict structural characteristics with `FlattenDimensions`.

---

<div class="post-metadata">

### Author: ![tuckermcclure](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tuckermcclure/32/1187_2.png) [@tuckermcclure](https://discourse.julialang.org/u/tuckermcclure)
#### Post date: [May 1, 2026, 5:02pm UTC](https://discourse.julialang.org/t/ann-dimensions-jl-a-library-for-accessing-the-scalar-dimensions-of-structured-types/136935/7 "2026-05-01T17:02:59Z")

</div>

I think I hear what you’re saying, @Benny. Good suggestions.

Consider that this is the desired (and current) behavior for “non-static” types:

```julia-auto
julia> using Dimensions

julia> x = [1.1, 2.2, 3.3];

julia> getdim(x, 3)
3.3

julia> numdims(x)
3

```

---

<div class="post-metadata">

### Author: ![tp2750](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tp2750/32/207806_2.png) [@tp2750](https://discourse.julialang.org/u/tp2750)
#### Post date: [May 3, 2026, 4:59am UTC](https://discourse.julialang.org/t/ann-dimensions-jl-a-library-for-accessing-the-scalar-dimensions-of-structured-types/136935/8 "2026-05-03T04:59:53Z")

</div>

I would expect the package Dimensions.jl to provide the type Dimension.  
I suggest calling it GetDimensions.jl to indicate that it mainly provides functions.

---

<div class="post-metadata">

### Author: ![jd-foster](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jd-foster/32/35824_2.png) [@jd-foster](https://discourse.julialang.org/u/jd-foster)
#### Post date: [May 3, 2026, 9:21am UTC](https://discourse.julialang.org/t/ann-dimensions-jl-a-library-for-accessing-the-scalar-dimensions-of-structured-types/136935/9 "2026-05-03T09:21:44Z")

</div>

> [@tuckermcclure](#):
>
> Counter-proposal: [ScalarDimensions.jl](https://juliaregistries.github.io/General/packages/redirect_to_repo/ScalarDimensions). That name makes it clearer that this is about “getting down the scalars” rather than other uses of the word “dimensions” like “array dimensions”.

I like that name, makes sense to me.
