# Why does subtype checks use \`\<:\` instead of just \`\<\`

**URL:** <https://discourse.julialang.org/t/why-does-subtype-checks-use-instead-of-just/19726>\
**Category:** General Usage\
**Created:** [January 16, 2019, 10:54pm UTC](https://discourse.julialang.org/t/why-does-subtype-checks-use-instead-of-just/19726 "2019-01-16T22:54:33Z")\
**Posts on this page:** 3\
**Page:** 2

<div class="post-metadata">

**Author:** ![WschW](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wschw/32/6575_2.png) [@WschW](https://discourse.julialang.org/u/WschW)\
**Post date:** [January 17, 2019, 3:44am UTC](https://discourse.julialang.org/t/why-does-subtype-checks-use-instead-of-just/19726/21 "2019-01-17T03:44:58Z")

</div>

> [@yuyichao](#):
>
> This is especially true now that the compiler, which is the heaviest user of type checks, won’t even care about it.

> [@yuyichao](#):
>
> now that the compiler

Does this imply that at one time the compiler would have been affected by such a redefinition? and that `<:` is not generic for historical reasons relating to that? Considering almost all functions in Julia are generic I am curious as to why `<:` and a few other functions aren’t generic.

---

<div class="post-metadata">

**Author:** ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)\
**Post date:** [January 17, 2019, 3:51am UTC](https://discourse.julialang.org/t/why-does-subtype-checks-use-instead-of-just/19726/22 "2019-01-17T03:51:47Z")

</div>

> [@WschW](#):
>
> Does this imply that at one time the compiler would have been affected by such a redefinition?

Mostly no. Inference has always (since a long time ago at least) have it’s own version of all the functions.

> [@WschW](#):
>
> and that `<:` is not generic for historical reasons relating to that?

Certainly no.

> [@WschW](#):
>
> a few other functions aren’t generic.

Because there has to be these functions. These are just operations that you have to be based on. A language with only semantics without any operation is quite useless.

However, they doesn’t have to be user facing functions. As I said, you can define `issubtype` as the builtin function and define your favorite operation by calling that. It’s exactly how many other functions are defined. You see a few of these simply because they are good enough as is and it’s mostly an implementation detail.

---

<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:** [January 17, 2019, 5:54am UTC](https://discourse.julialang.org/t/why-does-subtype-checks-use-instead-of-just/19726/23 "2019-01-17T05:54:04Z")

</div>

Certainly one could rename `<:` to `issubtype`, unexport it, define `<:(X, Y) = issubtype(X, Y)` and then export that. But would you really want an overloadable `<:` operator that doesn’t match the actual subtype relation? What good would that do? With `getproperty` the `x.f` syntax is the entire point. Nobody cares if you can write `X <: Y` and have it return true—they care about whether `X` actually behaves as a subtype of `Y`.

So the question of why `<:` isn’t a generic function is really “why can’t I define the subtype relation—and therefore dispatch—in completely user-defined arbitrary ways?” Which seems like it answers itself. If `<:` were arbitrarily user-definable how would one even guarantee basic things like that it is a predicate (always returns a boolean), and that it satisfies properties like reflexiveness and transitivity? Not to mention all the other properties that are necessary for a sane subtyping and dispatch system.

[Previous page](https://discourse.julialang.org/t/why-does-subtype-checks-use-instead-of-just/19726.md?page=1)
