# Overriding \<: function for subtype checking

**URL:** <https://discourse.julialang.org/t/overriding-function-for-subtype-checking/16867>\
**Category:** General Usage\
**Created:** [October 27, 2018, 5:41pm UTC](https://discourse.julialang.org/t/overriding-function-for-subtype-checking/16867 "2018-10-27T17:41:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Qiyamah](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/qiyamah/32/2660_2.png) [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Post date:** [October 27, 2018, 5:41pm UTC](https://discourse.julialang.org/t/overriding-function-for-subtype-checking/16867/1 "2018-10-27T17:41:15Z")

</div>

```nohighlight
ERROR: cannot add methods to a builtin function

```

Why can’t I do that? And is there a way to dispatch based on the defined \<: function in a polymorphic way?

Thanks

---

<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:** [October 27, 2018, 5:42pm UTC](https://discourse.julialang.org/t/overriding-function-for-subtype-checking/16867/2 "2018-10-27T17:42:10Z")

</div>

Is there a question?

---

<div class="post-metadata">

**Author:** ![Qiyamah](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/qiyamah/32/2660_2.png) [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Post date:** [October 27, 2018, 5:43pm UTC](https://discourse.julialang.org/t/overriding-function-for-subtype-checking/16867/3 "2018-10-27T17:43:33Z")

</div>

Sorry, i posted early by mistake. Added the question.

---

<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:** [October 27, 2018, 5:44pm UTC](https://discourse.julialang.org/t/overriding-function-for-subtype-checking/16867/4 "2018-10-27T17:44:53Z")

</div>

No, you cannot change the way subtyping works. Doing so would break everything. You can make your own generic function that calls `<:` and can be modified over that but dispatch will not use it.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [October 27, 2018, 6:08pm UTC](https://discourse.julialang.org/t/overriding-function-for-subtype-checking/16867/5 "2018-10-27T18:08:20Z")

</div>

Given your [previous question about overriding `=`](https://discourse.julialang.org/t/can-we-override/5856), I am curious what problem you are trying to solve. Maybe there is a simpler way to get what you want?
