`MVector` type yields `ImmutableDiffResult`
Hello, I'm using this package through LsqFit.jl. I have a 3d parameter vector, and would like to speed up the code by leveraging StaticArrays.jl, which basically come for free by passing a StaticVector instead of a Vector. In order to support in-place operations, we can further pass an MVector, i.e. a modifiable statically sized array. However, as seen below, Static Arrays always lead to ImmutableDiffResults.
https://github.com/JuliaDiff/DiffResults.jl/blob/80f085ebddbe2cabd691a61cb56cc1fd7fccd309/src/DiffResults.jl#L31-L52
I've done the following overloads to make it work for my case:
DiffResult(value::MArray, derivs::Tuple{Vararg{MArray}}) = MutableDiffResult(value, derivs)
DiffResult(value::Union{Number, AbstractArray}, derivs::Tuple{Vararg{MVector}}) = MutableDiffResult(value, derivs)
I think this is a useful feature and currently can be considered a bug. If there's interest in merging this I can also open a PR.
I agree that this behavior is not wanted, and I am actually questioning the utility of the mutable/immutable split (see #26)
If we do keep it, perhaps we should base the distinction on the output of ismutable?
I have opened #28 to keep track
Reopened cause the PR was temporarily reverted