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

New *(::Bool, ::Number) definition generates conflicts with other Number types #5611

Closed
jwmerrill opened this issue Jan 30, 2014 · 4 comments

Comments

@jwmerrill
Copy link

efcb565 introduced a *(::Bool, ::Number) method. This conflicts with definitions of the form

*{T<:Number}(::Real, ::T)

which I suspect most custom number types define. PowerSeries.jl for one has lots of newly conflicting definitions now.

Are there alternative possibilities for implementing whatever feature efcb565 is implementing? Should all Number types have to disambiguate themselves with Bool?

@mlubin
Copy link
Member

mlubin commented Jan 30, 2014

This also caused a conflict for DualNumbers.

@toivoh
Copy link
Contributor

toivoh commented Jan 30, 2014

I thought that this kind of thing should generally be handled with promote_type; you just can't define n_n methods of the _function for all possible combinations of lhs and rhs. Since it was decided to makefalsea strong zero,promote_type is not enough for that particular case, however.

@jwmerrill
Copy link
Author

Custom number types often define special * definitions that could in principle be handled by promotion for performance. Complex does it, and I bet rational does too. That's why I do it in PowerSeries.

Complex had to get two new * definitions to disambiguate with Bool in efcb565.

@quinnj
Copy link
Member

quinnj commented Jun 5, 2014

It looks like both packages affected here have resolved the ambiguities without too much hassle. Please reopen if something does need to be changed.

@quinnj quinnj closed this as completed Jun 5, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants