# Determine possibility to sort via hasmethod(isless, (T,T) for AbstractVector{T}

**URL:** <https://discourse.julialang.org/t/determine-possibility-to-sort-via-hasmethod-isless-t-t-for-abstractvector-t/14291>\
**Category:** General Usage\
**Created:** [August 30, 2018, 6:53am UTC](https://discourse.julialang.org/t/determine-possibility-to-sort-via-hasmethod-isless-t-t-for-abstractvector-t/14291 "2018-08-30T06:53:49Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![tkf](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkf/32/17635_2.png) [@tkf](https://discourse.julialang.org/u/tkf)\
**Post date:** [August 31, 2018, 10:28pm UTC](https://discourse.julialang.org/t/determine-possibility-to-sort-via-hasmethod-isless-t-t-for-abstractvector-t/14291/7 "2018-08-31T22:28:07Z")

</div>

I was asking exactly the same question a few weeks ago 🙂

> [@Can I use hasmethod inside @generated function?](https://discourse.julialang.org/t/can-i-use-hasmethod-inside-generated-function/13645):
>
> I thought the answer was no, since hasmethod is not pure. But unless I try very hard to break it (see struct B example below) I cannot invoke any suspicious bugs. From the example I wrote, it seems that using hasmethod inside @generated function is OK as long as the method checked by hasmethod is already defined before the first invocation of the method. Is it correct? Are there any other pitfalls? Am I relying on some implementation details of julia which can change in the future? To avoi…

---

_[View the full topic](https://discourse.julialang.org/t/determine-possibility-to-sort-via-hasmethod-isless-t-t-for-abstractvector-t/14291)._
