# Apparently more-specialised method not called

**URL:** <https://discourse.julialang.org/t/apparently-more-specialised-method-not-called/1811>\
**Category:** General Usage\
**Tags:** question\
**Created:** [February 1, 2017, 12:31am UTC](https://discourse.julialang.org/t/apparently-more-specialised-method-not-called/1811 "2017-02-01T00:31:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dpsanders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dpsanders/32/3573_2.png) [@dpsanders](https://discourse.julialang.org/u/dpsanders)\
**Post date:** [February 1, 2017, 12:31am UTC](https://discourse.julialang.org/t/apparently-more-specialised-method-not-called/1811/1 "2017-02-01T00:31:46Z")

</div>

I don’t understand the following behaviour:

```julia
julia> f(x::Real, y::Real) = x+y
f (generic function with 1 method)

julia> f(x::T, y::T) where T = x - y # 0.6 syntax; on 0.5 would be f{T}(x::T, y::T) = x - y
f (generic function with 2 methods)

julia> f(3, 4)
7

```

Shouldn’t the second, more specialized (to my eyes) method be called instead?

---

<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:** [February 1, 2017, 12:59am UTC](https://discourse.julialang.org/t/apparently-more-specialised-method-not-called/1811/2 "2017-02-01T00:59:39Z")

</div>

This is a missing ambiguity similar to (and simpler than) the case I had in [https://github.com/JuliaLang/julia/issues/20056#issuecomment-272757460](https://github.com/JuliaLang/julia/issues/20056#issuecomment-272757460)

---

<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:** [February 1, 2017, 1:00am UTC](https://discourse.julialang.org/t/apparently-more-specialised-method-not-called/1811/3 "2017-02-01T01:00:24Z")

</div>

The unambiguous case works correctly.

```julia
julia> f(::Real, ::Real) = 1
f (generic function with 1 method)

julia> f(::T, ::T) where T <: Real = 2
f (generic function with 2 methods)

julia> f(3, 4)
2

```
