Hey there,

I am trying to leverage Julia’s type system to get as many compile time protections as I can while still being performant. I’m using static arrays of reals for a project. Say I have a function `f1`

which can take an array `a`

, and perform some operation on it once `a`

has been sorted. Is it possible to create a subtype of Array which represents a sorted array? Then `f1`

in use might look like

```
function sorted(a :: Array{Real}) :: SortedArray{Real}
...
end
function f1(a :: SortedArray{Real})
...
end
# so that this fails since it's not guaranteed sorted
f1(a)
# but this works
f1(sorted(a))
```

In a similar spirit, I am working with 3D vectors represented like `SVector{3, N} where N`

, it’d be awesome if I could define functions which only accepted normalized vectors (you can imagine the analogy in code).

For both cases, I could probably write a struct/wrapper around the array, but that brings two problems for me:

- Will there be a performance hit?
- Is there a neat way to ensure all functions which worked with the original type also work for the new type?

So, can I create a direct subtype of Array without changing the data representation underneath? Thanks for bearing with, I’m still learning Julia’s type system.

Cheers,

Alex