Skip to content
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

replace! dispatches on ::Function #50888

Open
jariji opened this issue Aug 11, 2023 · 0 comments
Open

replace! dispatches on ::Function #50888

jariji opened this issue Aug 11, 2023 · 0 comments
Labels
breaking This change will break code speculative Whether the change will be implemented is speculative

Comments

@jariji
Copy link
Contributor

jariji commented Aug 11, 2023

I'm reporting functions that dispatch on types like ::Function. replace! is one of these.

replace!(A, old_new::Pair...; [count::Integer])
replace!(new::Function, A; [count::Integer])

I propose replacewith! a a new name for the one that takes a callable, by analogy to mergewith!, whose introduction is justified here:

With multiple dispatch, just as the meaning of a function is important to get consistent, it's also important to get the meanings of the argument slots consistent when possible. It's not ideal for a function to treat an argument in a fundamentally different way based on its type: e.g. "if this is a Function, then call it on pairs of values, otherwise assume it's a container providing the values to use".


Related issue: #49085

@brenhinkeller brenhinkeller added breaking This change will break code speculative Whether the change will be implemented is speculative labels Aug 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking This change will break code speculative Whether the change will be implemented is speculative
Projects
None yet
Development

No branches or pull requests

2 participants