@pure macro

@mbauman about mutable types: it’s okay to use mutable types in the intermediate computation if the output is immutable, right? The case I am thinking of is building an SVector for the result, but using a Vector to internally build that. Since

using StaticArrays
a = @SArray [1,2,3]
b = @SArray [1,2,3]
a === b # true

it seems like it would work, but I just wanted to double check. If so, that makes it much easier to build type-inferrable SArrays in functions.

If that’s the case, then I believe a function like this should be Base.@pure?

https://github.com/shivin9/PDEOperators.jl/blob/master/src/fornberg.jl#L34

1 Like