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

simplify reduction via promote_op #25591

Closed
wants to merge 1 commit into from
Closed

simplify reduction via promote_op #25591

wants to merge 1 commit into from

Conversation

simonbyrne
Copy link
Contributor

@simonbyrne simonbyrne commented Jan 16, 2018

We use Base.promote_op in a lot of other places, so it would make sense to use it here as well. This would also make it easier to extend. e.g. JuliaMath/FixedPointNumbers.jl#100 would only require adding 2 lines instead of 6.

@ararslan ararslan added maths Mathematical functions types and dispatch Types, subtyping and method dispatch labels Jan 16, 2018
@martinholters
Copy link
Member

I'm usually rather wary about using promote_op, but on a quick glance, these uses seem kosher.

@simonbyrne
Copy link
Contributor Author

Yeah, it would be nice if promote_op had some guidance on when it is valid to use. But at least with this structure, it is possible to manually specify the behaviour for any particular function.

@JeffBezanson
Copy link
Member

I can answer that one: it calls return_type, and so should never be used.

@JeffBezanson JeffBezanson removed the types and dispatch Types, subtyping and method dispatch label Apr 4, 2018
@giordano giordano deleted the sb/reduce branch December 27, 2022 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maths Mathematical functions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants