Skip to content

Conversation

JeffBezanson
Copy link
Member

This began as an attempt to fix the dispatch issue identified here: JuliaData/IndexedTables.jl#30 (comment)

Fixing that case led to a chain of related bugs, all of which needed to be fixed to get both that case and the rest of the tests passing. This entailed a minor overhaul of the specificity code, fixing a couple todo items and making the logic clearer overall. In particular we should now have the property that at most one of more_specific(a,b) and more_specific(b,a) can be true, which makes it much easier to reason about the code and was not always true before.

@JeffBezanson JeffBezanson added bugfix This change fixes an existing bug types and dispatch Types, subtyping and method dispatch labels Feb 18, 2017
args_morespecific(a, b) = ccall(:jl_type_morespecific, Cint, (Any,Any), a, b) != 0
let
a = Tuple{Type{T1}, T1} where T1<:Integer
a = Tuple{Type{T1}, T1} where T1<:Integer
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional space intentional? (For alignment?) And likewise below?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, aligning the types makes the test case much easier to read.

# (2) map[!] entry points
map{Tf}(f::Tf, A::SparseVecOrMat) = _noshapecheck_map(f, A)
map{Tf}(f::Tf, A::SparseVector) = _noshapecheck_map(f, A)
map{Tf}(f::Tf, A::SparseMatrixCSC) = _noshapecheck_map(f, A)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did these (and the similar broadcast) methods cause an ambiguity or so?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes this change makes ambiguity detection pickier again.

This definition of map was less specific in the type of A, but more specific in argument count compared to the next one.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cheers, thanks for the explanation!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix This change fixes an existing bug types and dispatch Types, subtyping and method dispatch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants