You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add functionality to Clear a sparse array of all its used values.
NB: Clearly document how this behaves in the case of an impure (e.g. mutable) index validation function. Probably it makes sense to clear the validation cache, since if someone is clearing the array then it's unlikely those indices are being used again.
Add unit tests e.g. Clear should reset the count to zero.
We may want to also implement a Clear() function that operates on a single value in the sparse array - removing it from the underlying dictionary. Again, care should be taken to clearly document & test how this interacts with the validation cache in the case of an impure function. In this case, probably it doesn't make sense to clear the validation cache because if just one value is cleared, there's a good chance someone will write to it again in future, and so it would be more efficient to have that index cached. In this sense, Clear() of a single value would behave much like the setter i.e. writing that value, in how it interacts with the index validation cache.
Value Proposition
(Description of what value arises from implementing this solution e.g. what problem does it solve)
Design Ideas
This could be implemented in terms of a Clear() function on the underlying curry dictionary. Note: this would likely be a lot more efficient than clearing individual values by removing them one by one- because to clear a curry dictionary we probably just have to remove all of its direct children.
The text was updated successfully, but these errors were encountered:
Requirement
Add functionality to Clear a sparse array of all its used values.
NB: Clearly document how this behaves in the case of an impure (e.g. mutable) index validation function. Probably it makes sense to clear the validation cache, since if someone is clearing the array then it's unlikely those indices are being used again.
Add unit tests e.g. Clear should reset the count to zero.
We may want to also implement a
Clear()
function that operates on a single value in the sparse array - removing it from the underlying dictionary. Again, care should be taken to clearly document & test how this interacts with the validation cache in the case of an impure function. In this case, probably it doesn't make sense to clear the validation cache because if just one value is cleared, there's a good chance someone will write to it again in future, and so it would be more efficient to have that index cached. In this sense,Clear()
of a single value would behave much like the setter i.e. writing that value, in how it interacts with the index validation cache.Value Proposition
(Description of what value arises from implementing this solution e.g. what problem does it solve)
Design Ideas
This could be implemented in terms of a
Clear()
function on the underlying curry dictionary. Note: this would likely be a lot more efficient than clearing individual values by removing them one by one- because to clear a curry dictionary we probably just have to remove all of its direct children.The text was updated successfully, but these errors were encountered: