# StaticArrays 0.12.0 - New static array literal syntax

**URL:** https://discourse.julialang.org/t/staticarrays-0-12-0-new-static-array-literal-syntax/30645
**Category:** Package Announcements
**Created:** [November 3, 2019, 4:36am UTC](https://discourse.julialang.org/t/staticarrays-0-12-0-new-static-array-literal-syntax/30645 "2019-11-03T04:36:14Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![c42f](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/c42f/32/52842_2.png) [@c42f](https://discourse.julialang.org/u/c42f)
#### Post date: [November 3, 2019, 4:36am UTC](https://discourse.julialang.org/t/staticarrays-0-12-0-new-static-array-literal-syntax/30645/1 "2019-11-03T04:36:14Z")

</div>

Hi all, I’ve just released [StaticArrays Release 0.12.0](https://github.com/JuliaArrays/StaticArrays.jl/releases/tag/v0.12.0). I’d like to reach [version 1.0](https://github.com/JuliaArrays/StaticArrays.jl/issues/532) soon so we’ve been doing some cleanup in the last few months and working on a few long standing problems.

One is the issue of conveniently and unambiguously constructing short static arrays from their components. `Base` is privileged to have the `Vector` and `Matrix` literal syntaxes like `[1,2,3]` and `[1 2; 3 4]`, but it’s hard to have something quite as nice in a package. We have the macros like `@SMatrix` but there’s a lot of them, they’re verbose and annoyingly non-extensible.

In version 0.12.0 we now have the special “SArray constructor” type `SA`:

```julia
julia> v = SA[1,2,3]
3-element SArray{Tuple{3},Int64,1,3} with indices SOneTo(3):
 1
 2
 3

julia> m = SA[1.0 2.0
              3.0 4.0]
2×2 SArray{Tuple{2,2},Float64,2,4} with indices SOneTo(2)×SOneTo(2):
 1.0 2.0
 3.0 4.0

```

This lets you construct `SVector` and `SMatrix` with almost the same syntax as `Base`. If you want a particular element type, there’s also the type aliases `SA_F64` and `SA_F32` for `Float64` and `Float32` eltypes, and you can specify your own eltypes with `SA{T}`. For example:

```julia
SA[1, 2, 3] isa SVector{3,Int}
SA_F64[1, 2, 3] isa SVector{3,Float64}
SA_F32[1, 2, 3] isa SVector{3,Float32}
SA[1 2; 3 4] isa SMatrix{2,2,Int}
SA_F64[1 2; 3 4] isa SMatrix{2,2,Float64}
SA{UInt8}[1,2] isa SVector{2,UInt8}

```

This doesn’t entirely solve the problem of creating other types of static array but it’s possible to use conversion; for example `MMatrix(SA[1 2; 3 4])`.

There’s also a lot of other fixes in this release thanks to many people (thanks especially to @mateuszbaran for jumping in and cheerfully fixing various long standing issues!). Another notable change is the generalization of `FieldVector` to arbitrary dimensional `FieldArray`s thanks to @CFBaptista.

---

<div class="post-metadata">

### Author: ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)
#### Post date: [November 3, 2019, 8:16am UTC](https://discourse.julialang.org/t/staticarrays-0-12-0-new-static-array-literal-syntax/30645/2 "2019-11-03T08:16:32Z")

</div>

Very neat implementation! It did not occur to me that one can use `Base.typed_vcat` & friends that way. Perhaps these functions should be documented in more detail in `Base`.

---

<div class="post-metadata">

### Author: ![greg\_plowman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/greg_plowman/32/8100_2.png) [@greg\_plowman](https://discourse.julialang.org/u/greg_plowman)
#### Post date: [November 3, 2019, 10:09pm UTC](https://discourse.julialang.org/t/staticarrays-0-12-0-new-static-array-literal-syntax/30645/3 "2019-11-03T22:09:27Z")

</div>

This looks great!

But my StaticArrays is stuck at `v0.11.1`.

How can discover why it’s not upgrading?

These seem to point to a Julia v0.6 script.

- [How to identify julia packages that hold back newer versions of other packages? - Stack Overflow](https://stackoverflow.com/questions/50066891/how-to-identify-julia-packages-that-hold-back-newer-versions-of-other-packages)
- [How to tell which package is holding back which package](https://discourse.julialang.org/t/how-to-tell-which-package-is-holding-back-which-package/24827)
- [How to find package preventing others from updating](https://discourse.julialang.org/t/how-to-find-package-preventing-others-from-updating/8235)

---

<div class="post-metadata">

### Author: ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)
#### Post date: [November 3, 2019, 10:11pm UTC](https://discourse.julialang.org/t/staticarrays-0-12-0-new-static-array-literal-syntax/30645/4 "2019-11-03T22:11:51Z")

</div>

Try `] add StaticArrays@0.12.0` the output for which should tell you what’s holding you back.

---

<div class="post-metadata">

### Author: ![greg\_plowman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/greg_plowman/32/8100_2.png) [@greg\_plowman](https://discourse.julialang.org/u/greg_plowman)
#### Post date: [November 3, 2019, 11:05pm UTC](https://discourse.julialang.org/t/staticarrays-0-12-0-new-static-array-literal-syntax/30645/5 "2019-11-03T23:05:40Z")

</div>

Thanks!

The culprit seems to be `LazyArrays`:

```julia
(v1.2) pkg> add StaticArrays@0.12.0
  Updating registry at `C:\Users\plowman\.julia\registries\General`
  Updating git-repo `https://github.com/JuliaRegistries/General.git`
 Resolving package versions...
ERROR: Unsatisfiable requirements detected for package LazyArrays [5078a376]:
 LazyArrays [5078a376] log:
 ├─possible versions are: [0.0.1, 0.1.0-0.1.1, 0.2.0-0.2.1, 0.3.0-0.3.2, 0.4.0, 0.5.0-0.5.2, 0.6.0, 0.7.0-0.7.1, 0.8.0-0.8.1, 0.9.0-0.9.1, 0.10.0, 0.11.0, 0.12.0-0.12.3, 0.13.0] or uninstalled
 ├─restricted to versions 0.13.0 by an explicit requirement, leaving only versions 0.13.0
 └─restricted by compatibility requirements with StaticArrays [90137ffa] to versions: [0.0.1, 0.1.0-0.1.1, 0.2.0-0.2.1, 0.3.0-0.3.2, 0.4.0, 0.5.0-0.5.2, 0.6.0, 0.7.0-0.7.1, 0.8.0-0.8.1, 0.9.0-0.9.1] or uninstalled — no versions left
   └─StaticArrays [90137ffa] log:
     ├─possible versions are: [0.8.0-0.8.3, 0.9.0-0.9.2, 0.10.0, 0.10.2-0.10.3, 0.11.0-0.11.1, 0.12.0] or uninstalled
     └─restricted to versions 0.12.0 by an explicit requirement, leaving only versions 0.12.0

```

---

<div class="post-metadata">

### Author: ![c42f](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/c42f/32/52842_2.png) [@c42f](https://discourse.julialang.org/u/c42f)
#### Post date: [November 4, 2019, 12:44am UTC](https://discourse.julialang.org/t/staticarrays-0-12-0-new-static-array-literal-syntax/30645/6 "2019-11-04T00:44:31Z")

</div>

See [https://github.com/JuliaArrays/LazyArrays.jl/pull/79](https://github.com/JuliaArrays/LazyArrays.jl/pull/79)
