# A way to get the latest method of a function?

**URL:** <https://discourse.julialang.org/t/a-way-to-get-the-latest-method-of-a-function/26766>\
**Category:** General Usage\
**Created:** [July 25, 2019, 12:45am UTC](https://discourse.julialang.org/t/a-way-to-get-the-latest-method-of-a-function/26766 "2019-07-25T00:45:39Z")\
**Posts on this page:** 4\
**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:** [July 25, 2019, 12:45am UTC](https://discourse.julialang.org/t/a-way-to-get-the-latest-method-of-a-function/26766/1 "2019-07-25T00:45:39Z")

</div>

Hi, everyone.

Example:

```nohighlight

f(x::Int) = x+1
mt = get_latest_method(f) # mt -> function f with signature Int
f(x::Float64) = x*2.0
mt = get_latest_method(f) # mt -> function f with signature Float64
f(x::Int,y::Float64) = x*y
mt = get_latest_method(f) # mt -> function f with signature (Int,Float64)

```

Is there a way to do this?

please don’t tell me to diff between 2 methods(f) to see which one it is.  
There should be adding order to the methodlist

Thanks

---

<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:** [July 25, 2019, 1:05am UTC](https://discourse.julialang.org/t/a-way-to-get-the-latest-method-of-a-function/26766/2 "2019-07-25T01:05:02Z")

</div>

Basically no. Why do you need this? If you want to differenciate between methods you should just use multiple functions.

---

<div class="post-metadata">

**Author:** ![tim.holy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tim.holy/32/52_2.png) [@tim.holy](https://discourse.julialang.org/u/tim.holy)\
**Post date:** [July 25, 2019, 1:33am UTC](https://discourse.julialang.org/t/a-way-to-get-the-latest-method-of-a-function/26766/3 "2019-07-25T01:33:32Z")

</div>

Yes there is an order to the method list, but it’s based on specificity more than temporal sequence of addition.

Do you know about `m = @which f(1, 1.0)`?

---

<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:** [July 25, 2019, 1:45am UTC](https://discourse.julialang.org/t/a-way-to-get-the-latest-method-of-a-function/26766/4 "2019-07-25T01:45:05Z")

</div>

I see that is enlightening.

Thanks
