Why has subtypes function been moved to module InteractiveUtils? (v0.7.0)


#1

I noticed that function subtypes has been moved to module InteractiveUtils. However the supertype function remained in Base.operators.jl. Why is that?

In my opinion subtypes should have remained in Base. If supertype has a legitimate role in Julia code, then so does subtypes.


#2

It seems that subtypes is still exported from Base, so it being located in InteractiveUtils doesn’t currently affect the user.

I agree that both supertype and subtypes should be in Base and exported to the user, though I don’t have any opinion on whether it should be in InteractiveUtils.


#3

When I tested my own package using Julia v0.70-beta I got the following message

WARNING: Base.subtypes is deprecated: it has been moved to 
the standard library package `InteractiveUtils`.
Add `using InteractiveUtils` to your imports.

So clearly the current intent is to move the subtypes function out of Base.


#4

Because it’s largely useful as an interactive utility.


#5

I understand that part and I agree that it is a reasonable assumption for all other functions and macros defined in InteractiveUtils.

But if I want to use ‘subtypes’ it in my regular code (just as I would want to use ‘supertype’), I’d have to import/using package InteractiveUtils in my package and add it to the package dependencies.
That seems somewhat heavy-handed for just wanting to use the function ‘subtypes’.


#6

Supertype is an immediate and unchangeable property of a type. Subtypes is not like that at all: the entire type graph has to be walked to compute it and it changes any time someone defines a new subtype. Any code that’s using it in a way that’s not just exploratory is fairly suspect.


#7

I see your point. Thanks.