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:
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.
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.
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”.
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.
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.