Skip to content

[breaking] s/DataType/Type #1501

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

Merged
merged 3 commits into from
Jul 28, 2021
Merged

[breaking] s/DataType/Type #1501

merged 3 commits into from
Jul 28, 2021

Conversation

odow
Copy link
Member

@odow odow commented Jul 28, 2021

Closes #783

We should use Type instead of DataType.

The issue is that DataType is a concrete type of Type (confusing right) that causes the compiler problems (to quote Jeff "this sort of stuff drives the compiler crazy" and "if you're doing that, please stop").

julia> isconcretetype(DataType)
true

julia> subtypes(Type)
4-element Vector{Any}:
 Core.TypeofBottom
 DataType
 Union
 UnionAll

I tried a few other things, such as Tuple{Type{<:MOI.AbstractFunction},Type{<:MOI.AbstractSet}} but couldn't get them to work. It seems for a lot of these things, we want simpler type signatures with some run-time asserts to reduce our latency. These paths aren't hot and time-critical.

@odow odow added the breaking label Jul 28, 2021
@odow odow requested a review from blegat July 28, 2021 07:18
Copy link
Member

@blegat blegat left a comment

Choose a reason for hiding this comment

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

Looks good to me. I'm wondering whether I tried Tuple{Type,Type} at the time but if it works and the compiler does not like DataType then let's use that.

@odow odow merged commit aabc47c into master Jul 28, 2021
@odow odow deleted the od/DataType branch July 28, 2021 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

Use Type{<:...} instead of DataType
2 participants