-
Notifications
You must be signed in to change notification settings - Fork 2
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
Map.delete and pure/Map.delete have inconsistent semantics #160
Comments
What about Another variation is The motivation is for It might be good to keep "add" and "remove" (or I suppose "put" and "delete") in both of the names if possible, since otherwise it could be confusing to new developers who might mix up which functions are paired with each other. |
Boolean add and remove would solve the problem but might lead to awkward code with all those ignores in the common case. And would 'addAll' etc return a bool and if so, with what semantics ? Maybe just non-trapping add/remove I was also wondering if we could use Union/intersection/difference (creating a new map) Let's talk tomorrow... |
I'd be ok with this, although a remaining concern is that it might be confusing to remember which ones return a boolean.
In this case, we might want to rename the functions Overall, I've been choosing names based on consistency first, clarity second, and conciseness third as an explanation for thinking |
The other thing that strikes me is that the Boolean ones are truly awkward in the functional api since you need to return a new map and a Boolean. Wouldn't be so bad if we had subtyping on tuples (you could ignore the second value) but we don't.. |
The former traps deleting an absent key, the latter does not.
I suggest
add/remove trapping
put/delete non-trapping
The text was updated successfully, but these errors were encountered: