Here's what I wanted to understand:
Suppose we have a simple function that is declared and then called:
func f(a: Int, b: Int) { }
f(a: 1, b: 2)
It's easy to know here that a
has a value of 1
and b
has a value of 2
. However, this can get more complicated when we consider there can be default values, variadics, arguments with no names, etc:
func g(_ a: Int, _ b: Int = 0, _ c: Int, _ d: Int...) { }
g(1, 2, 3, 4, 5)
Now, I assume there's a strict set of rules that determine which values go to which arguments. Are they documented somewhere? Is there an algorithm somewhere in the compiler that explains this process?