# Counterexamples to the interpretation \`\<:\` means "is a subtype of"

**URL:** https://discourse.julialang.org/t/counterexamples-to-the-interpretation-means-is-a-subtype-of/57274
**Category:** New to Julia
**Tags:** question
**Created:** [March 16, 2021, 8:24am UTC](https://discourse.julialang.org/t/counterexamples-to-the-interpretation-means-is-a-subtype-of/57274 "2021-03-16T08:24:42Z")
**Posts on this page:** 4
**Page:** 2

<div class="post-metadata">

### Author: ![simeonschaub](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/simeonschaub/32/216566_2.png) [@simeonschaub](https://discourse.julialang.org/u/simeonschaub)
#### Post date: [March 16, 2021, 1:34pm UTC](https://discourse.julialang.org/t/counterexamples-to-the-interpretation-means-is-a-subtype-of/57274/21 "2021-03-16T13:34:42Z")

</div>

`Ptr` is an alias for `Ptr{T} where T`, which is a `UnionAll`. Is this not exactly what you are asking for?

---

<div class="post-metadata">

### Author: ![path-doc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/path-doc/32/19183_2.png) [@path-doc](https://discourse.julialang.org/u/path-doc)
#### Post date: [March 16, 2021, 1:43pm UTC](https://discourse.julialang.org/t/counterexamples-to-the-interpretation-means-is-a-subtype-of/57274/22 "2021-03-16T13:43:29Z")

</div>

```nohighlight
julia> subtypes(Ptr)
Type[]

```

Even though you and I both know it contains arbitrarily many subtypes. That’s all I’m saying.

---

<div class="post-metadata">

### Author: ![CameronBieganek](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cameronbieganek/32/6915_2.png) [@CameronBieganek](https://discourse.julialang.org/u/CameronBieganek)
#### Post date: [March 16, 2021, 1:55pm UTC](https://discourse.julialang.org/t/counterexamples-to-the-interpretation-means-is-a-subtype-of/57274/23 "2021-03-16T13:55:16Z")

</div>

Perhaps the docstring for `subtypes` could be improved. My understanding is that it only returns the _explicitly declared_ subtypes of a type. Consider the following code:

```julia
abstract type A{T} end
struct B{T} <: A{T} end

```

`A{Int}` is not _explicitly_ declared to be a subtype of `A`, and neither is `B{Int}`.

```julia
julia> A{Int} <: A
true

julia> B{Int} <: A
true

julia> subtypes(A)
1-element Array{Any,1}:
 B

```

Loosely speaking, the only part of the above definition that is explicitly declared is `B <: A`. By _explicit_, I mean it’s what is in the source code.

---

<div class="post-metadata">

### Author: ![sostock](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sostock/32/5546_2.png) [@sostock](https://discourse.julialang.org/u/sostock)
#### Post date: [March 16, 2021, 2:04pm UTC](https://discourse.julialang.org/t/counterexamples-to-the-interpretation-means-is-a-subtype-of/57274/24 "2021-03-16T14:04:00Z")

</div>

> [@path-doc](#):
>
> ```julia
> julia> subtypes(Ptr)
> Type[]
> 
> ```
> 
> Even though you and I both know it contains arbitrarily many subtypes. That’s all I’m saying.

So what should `subtypes(Ptr)` return in your opinion?

[Previous page](https://discourse.julialang.org/t/counterexamples-to-the-interpretation-means-is-a-subtype-of/57274.md?page=1)
