Skip to content

Commit

Permalink
fixup! feat: change remake_buffer signature, deprecate old one
Browse files Browse the repository at this point in the history
  • Loading branch information
AayushSabharwal committed Aug 7, 2024
1 parent af2b0f8 commit cb289a6
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/remake.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@ This method is already implemented for `oldbuffer::AbstractArray` and `oldbuffer
and supports static arrays as well.
The deprecated version of this method which takes a `Dict` mapping symbols to values
instead of `idxs` and `vals` will dispatch to the new method.
instead of `idxs` and `vals` will dispatch to the new method. In addition if
no `remake_buffer` method exists with the new signature, it will call
`remake_buffer(sys, oldbuffer, Dict(idxs .=> vals))`.
Note that the new method signature allows `idxs` to be indexes, instead of requiring
that they be symbolic variables. Thus, any type which implements the new method must
also support indexes in `idxs`.
"""
function remake_buffer(sys, oldbuffer::AbstractArray, idxs, vals)
# similar when used with an `MArray` and nonconcrete eltype returns a
Expand Down Expand Up @@ -48,6 +54,10 @@ function remake_buffer(sys, oldbuffer::AbstractArray, idxs, vals)
return newbuffer
end

function remake_buffer(sys, oldbuffer, idxs, vals)
remake_buffer(sys, oldbuffer, Dict(idxs .=> vals))
end

mutable struct TupleRemakeWrapper
t::Tuple
end
Expand Down

0 comments on commit cb289a6

Please sign in to comment.