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

**URL:** <https://discourse.julialang.org/t/why-has-subtypes-function-been-moved-to-module-interactiveutils-v0-7-0/11975>\
**Category:** General Usage\
**Created:** [June 26, 2018, 5:54pm UTC](https://discourse.julialang.org/t/why-has-subtypes-function-been-moved-to-module-interactiveutils-v0-7-0/11975 "2018-06-26T17:54:39Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jandehaan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jandehaan/32/6805_2.png) [@jandehaan](https://discourse.julialang.org/u/jandehaan)\
**Post date:** [June 26, 2018, 5:54pm UTC](https://discourse.julialang.org/t/why-has-subtypes-function-been-moved-to-module-interactiveutils-v0-7-0/11975/1 "2018-06-26T17:54:39Z")

</div>

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`.

---

<div class="post-metadata">

**Author:** ![ExpandingMan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/expandingman/32/866_2.png) [@ExpandingMan](https://discourse.julialang.org/u/ExpandingMan)\
**Post date:** [June 26, 2018, 5:59pm UTC](https://discourse.julialang.org/t/why-has-subtypes-function-been-moved-to-module-interactiveutils-v0-7-0/11975/2 "2018-06-26T17:59:52Z")

</div>

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`.

---

<div class="post-metadata">

**Author:** ![jandehaan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jandehaan/32/6805_2.png) [@jandehaan](https://discourse.julialang.org/u/jandehaan)\
**Post date:** [June 26, 2018, 6:05pm UTC](https://discourse.julialang.org/t/why-has-subtypes-function-been-moved-to-module-interactiveutils-v0-7-0/11975/3 "2018-06-26T18:05:49Z")

</div>

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

```julia
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.

---

<div class="post-metadata">

**Author:** ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)\
**Post date:** [June 26, 2018, 6:53pm UTC](https://discourse.julialang.org/t/why-has-subtypes-function-been-moved-to-module-interactiveutils-v0-7-0/11975/4 "2018-06-26T18:53:15Z")

</div>

Because it’s largely useful as an interactive utility.

---

<div class="post-metadata">

**Author:** ![jandehaan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jandehaan/32/6805_2.png) [@jandehaan](https://discourse.julialang.org/u/jandehaan)\
**Post date:** [June 26, 2018, 6:59pm UTC](https://discourse.julialang.org/t/why-has-subtypes-function-been-moved-to-module-interactiveutils-v0-7-0/11975/5 "2018-06-26T18:59:30Z")

</div>

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’.

---

<div class="post-metadata">

**Author:** ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)\
**Post date:** [June 26, 2018, 7:02pm UTC](https://discourse.julialang.org/t/why-has-subtypes-function-been-moved-to-module-interactiveutils-v0-7-0/11975/6 "2018-06-26T19:02:25Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jandehaan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jandehaan/32/6805_2.png) [@jandehaan](https://discourse.julialang.org/u/jandehaan)\
**Post date:** [June 26, 2018, 7:03pm UTC](https://discourse.julialang.org/t/why-has-subtypes-function-been-moved-to-module-interactiveutils-v0-7-0/11975/7 "2018-06-26T19:03:32Z")

</div>

I see your point. Thanks.
