-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
delete replace!(pred, A, new) #27944
Conversation
I agree it's too confusing to have one method that takes a predicate, and another that takes a mapping function. |
But, |
At this point in the release, triage wants to minimize disruptions. |
Yes I wanted to mention this one but forgot. It's not needed to remove it for the possible ambiguity with another method, but maybe for consistency or if we remove the predicate methods because "it's too confusing to have one method that takes a predicate, and another that takes a mapping function."
I understand; as it was not available on 0.6, I thought it would hopefully be not too disruptive. |
@JeffBezanson Can you confirm that triage decided against this change? Your previous message was not so explicit, and I see breaking changes still being done when this one would be practically non-breaking given it supresses a function introduced only in 0.7. |
Yes, triage decided against it, but I see now that it's just deleting something added only during 0.7, so deleting it might actually be the safer thing to do. |
f9e7351
to
769562b
Compare
Ok, so I deleted also the non-mutating function for consistency. After thinking a bit more, I still think also that this is the safer thing to do. I'm a bit sad to see the functionality go away (for the non-mutating one, we even loose a bit of non-trivial functionality, e.g.
|
769562b
to
cebd0fe
Compare
Someone feeling like merging? |
replace!(pred, A, new)
replaces all values inA
for whichpred
is true by the valuenew
. It's a very thin wrapper overreplace!(new, A)
.It was noted in #26206 that this method is ambiguous with another potentially useful method
replace!(new, destination, source)
wherenew
is a function giving the updated value given the old value. This method is already more or less implemented with the nameBase._replace!
. It would be a more general version ofreplace!(new, A)
.Admitedly, this
replace!(new, destination, source)
method would have quite some overlap withmap!
(one difference being thatreplace!
accepts acount
keyword).We could decide to remove conservatively
replace!(pred, A, new)
so that we have more time to think about this problem.replace!
was introduced in 0.7, so it would not be (strongly) breaking.I don't have a clear opinion on this; marking for triage.