-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rename replaceIf or setAt #65
Comments
Answering question one, we've already made some major changes, so I think now is the time to cohere the names of set, replace, and update; otherwise I would be more hesitant. Maybe we should rename I do think update has independent value from set and replace. Set and replace take a distinct value, where as update is agnostic on what value its updating. Without update, you have to get the value, and then replace it. |
I agree with you about the timing due to having already made breaking changes for the next version. Regarding # 3, I was actually suggesting that we get rid of |
Like if they want to replace, they should do something like |
Correct, that's all we would be doing in our implementation anyway. (Currently the implementation for setAt is more complicated, but that should change once I find the time to finish #55.) The convenience it provides is pretty minimal. One point in favor of keeping it would be that using I'm somewhat indifferent on the matter of removing it, but I do think that if we choose to keep it either |
I think keeping it is a much better option. Its conceptually simplest that their would be different functions for setting, updating, and replacing, even if a little bit of reasoning can show that an update is a kind of replace. More functions necessary to execute an update (as is the case in |
Now that I've had some time to think about it, I agree with you. My vote is in favor of renaming |
@Chadtech Let me know if you want a PR for this. |
Closing since we followed through on this. |
replaceIf
andsetAt
are really two variants of the same kind of operation. They both replace some element(s) with a given value. Perhaps their naming should reflect this similarity. (Similar to how we haveupdateIf
andupdateAt
.) Some questions to consider.Array
uses the nameset
for a similar operation.)setAt
andreplaceIf
when they are essentially equivalent to callingupdateAt
andupdateIf
with an update function ofalways x
.The text was updated successfully, but these errors were encountered: