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

add supertypes(T) function #34419

Merged
merged 3 commits into from
Jan 30, 2020
Merged

add supertypes(T) function #34419

merged 3 commits into from
Jan 30, 2020

Conversation

stevengj
Copy link
Member

Closes #34362, adding this function to InteractiveUtils along with subtypes.

Unlike subtypes, returns a tuple instead of an array, just in case we ever decide that we want this function to work statically (since it can).

@JeffBezanson
Copy link
Member

One reason to discourage code from depending on supertypes is that they are not part of API stability guarantees --- we are allowed to insert new abstract types in the hierarchy in 1.x. So enabling compile-time tricks with them might not be for the best.

@stevengj
Copy link
Member Author

stevengj commented Jan 17, 2020

@JeffBezanson, I'm not sure I understand your point. You can't insert new abstract types into the type hierarchy of a given binary after compilation, so compile-time usage of supertypes are perfectly safe, no? Besides, the supertype function itself is already @_pure_meta, so the horse is out of the barn.

(Hard-coding dependence on the specific supertypes might be bad, but this doesn't apply to code that uses a function like supertype.)

@JeffBezanson
Copy link
Member

JeffBezanson commented Jan 17, 2020

It's safe, just subject to breakage. But ¯\_(ツ)_/¯

@JeffBezanson JeffBezanson added the triage This should be discussed on a triage call label Jan 21, 2020
@JeffBezanson JeffBezanson merged commit c21020b into master Jan 30, 2020
@JeffBezanson JeffBezanson deleted the supertypes branch January 30, 2020 19:31
@JeffBezanson JeffBezanson removed the triage This should be discussed on a triage call label Jan 30, 2020
KristofferC pushed a commit that referenced this pull request Apr 11, 2020
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

Successfully merging this pull request may close these issues.

supertypes(T) function?
2 participants