# How to interpret "Type{T} where T" in Julia's type system

**URL:** https://discourse.julialang.org/t/how-to-interpret-type-t-where-t-in-julias-type-system/37402
**Category:** New to Julia
**Tags:** question, type, parametric-types
**Created:** [April 11, 2020, 4:24pm UTC](https://discourse.julialang.org/t/how-to-interpret-type-t-where-t-in-julias-type-system/37402 "2020-04-11T16:24:34Z")
**Posts on this page:** 1
**Showing post:** 12

<div class="post-metadata">

### Author: ![mrufsvold](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mrufsvold/32/31600_2.png) [@mrufsvold](https://discourse.julialang.org/u/mrufsvold)
#### Post date: [April 3, 2025, 4:19am UTC](https://discourse.julialang.org/t/how-to-interpret-type-t-where-t-in-julias-type-system/37402/12 "2025-04-03T04:19:41Z")

</div>

Three confusing things are happening here:

1. In Julia, types are values and values are types. We can’t draw clear distinctions between them. All types are values that are instances of `DataType` (well, almost `Union{}` strikes again!). But that means we couldn’t dispatch on a type because they are all `DataType`s. So…
2. [`Type` is a](https://stackoverflow.com/questions/42283820/julia-difference-between-type-and-datatype) unique, [special-cased type](https://discourse.julialang.org/t/datatype-and-type-datatype/88815) that allows for [sharpening type fields](https://docs.julialang.org/en/v1/manual/types/#man-typet-type). ~~It is extremely important to dispatch and such, but it does cause a violation of the type system’s rules which–I believe–leads to the friction you’re experiencing. Specifically, while each type is an instance of the concrete type `DataType`, it is ALSO an instance of the concrete type `Type{T}` (for some T). This is normally impossible (an instance can only be of one concrete type)~~. Edit: see my comment below, this is not correct.
3. `Any` is the top of that type system. By definition, all types are subtypes of `Any`. But `Any` is also an _instance of_ `DataType` because types are just values. Not too weird, but it does yield funny things like:

```julia
julia> typeof(Any) <: Any
true

```

Your taxonomy of types doesn’t work because it presupposes that there are different kinds of types. There are not. Julia has a type system which describes the super- and sub-type relationships between all types, without drawing distinctions between those types.

The “issue” that

> [@LEXUGE](#):
>
> **Note further** that `Any` in the line above is a level-2 type while `Any` in `Int <: Any` is a level-1 type!!!

Isn’t an issue for the soundness of the system. Walking through it:

1. `Int isa Type{Int}` – as we’ve addressed, this is the odd case.
2. `Type{Int} <: DataType` – This is true because in a deep way `Type{T} where T === DataType`, so this is like saying `Type{Int} <: Type` which is true.
3. `DataType <: Type` – All types, including `DataType`, are `Type`s. Specifically, `DataType isa Type{DataType}`.
4. `Type <: Any` this is axiomatic to the Julia type system.

I also don’t understand where your claim that:

> [@LEXUGE](#):
>
> `isconcretetype(DataType)` really should be false according to the documentation.

comes from in the docs? Can you clarify the contradiction you’re seeing? Based on my reading of your code example above that claim, I don’t see an issue.

- `DataType` is the type of all types. So `DataType` (being a type) is an instance of `DataType`.
- Also, `T <: T` is true for all `T` where `T` is a type. So `DataType <: DataType` must be true.
- `DataType` is an unparametrized type that has instances (all the other types), so it behaves like any concrete type.

Edit: Thinking about this more – I’m actually wondering if it’s more like `DataType` is the real special case because it is basically `Type{T} where T` in a trenchcoat pretending to be concrete even though it’s a `UnionAll`? I don’t know. Someone who knows more Type Theory will have to weigh in there 😅

---

_[View the full topic](https://discourse.julialang.org/t/how-to-interpret-type-t-where-t-in-julias-type-system/37402)._
