# Function with Vararg and Missing ambiguity check?

**URL:** https://discourse.julialang.org/t/function-with-vararg-and-missing-ambiguity-check/52657
**Category:** Internals & Design
**Tags:** question
**Created:** [December 31, 2020, 12:15pm UTC](https://discourse.julialang.org/t/function-with-vararg-and-missing-ambiguity-check/52657 "2020-12-31T12:15:06Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![tomaklutfu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tomaklutfu/32/2411_2.png) [@tomaklutfu](https://discourse.julialang.org/u/tomaklutfu)
#### Post date: [December 31, 2020, 12:15pm UTC](https://discourse.julialang.org/t/function-with-vararg-and-missing-ambiguity-check/52657/1 "2020-12-31T12:15:06Z")

</div>

Consider the function with two methods

```julia
julia> f(::Integer, x::Vararg{Integer, N}) where {N} = NTuple{N,Int}(s) # Here s intentional
f (generic function with 1 method)

julia> f(::Integer, x::Vararg{Any, N}) where {N} = NTuple{N,Int}(x)
f (generic function with 2 methods)

```

For the one argument case they seem ambiguous but the signature with `Vararg{Integer, N}` is used. Is there

```julia
julia> f(9)
ERROR: UndefVarError: s not defined
Stacktrace:
 [1] f(::Int64)
   @ Main ./REPL[1]:1
 [2] top-level scope
   @ REPL[3]:1

```

It only become ambiguous if I have one more method that is more specific than `Any` for `Vararg`. Is this intentional since `Integer` is more specific or left as an edge case?

---

<div class="post-metadata">

### Author: ![simeonschaub](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/simeonschaub/32/216566_2.png) [@simeonschaub](https://discourse.julialang.org/u/simeonschaub)
#### Post date: [December 31, 2020, 12:39pm UTC](https://discourse.julialang.org/t/function-with-vararg-and-missing-ambiguity-check/52657/2 "2020-12-31T12:39:03Z")

</div>

> [@tomaklutfu](#):
>
> It only become ambiguous if I have one more method that is more specific than `Any` for `Vararg` . Is this intentional since `Integer` is more specific or left as an edge case?

I think since we have:

```julia
julia> Tuple{Integer,Vararg{Integer}} <: Tuple{Integer,Vararg{Any}}
true

```

if the first one matches, it is always considered more specific.
