Question about scoping inside a function

I don’t see what is different with what I am trying to do and the following:

function f()
    g(x::Int) = println("Here 1")
    g(x::Float64) = println("Here 2")
    g(1)
    g(2.0)
end
julia> f()
Here 1
Here 2