Partial application kind of permitted with `init`?

I saw some syntax in a codebase I found odd so I've been trying to understand what's going on.

struct Numbers {
  public var a: Int

  public init(a: Int) {
    self.a = a
  }
}

print(Numbers(a:))

As I understand it Swift doesn't support partial application so this came as quite a surprise. I then extended the example a little to try two params.

struct Numbers {
  public var a: Int
  public var b: Int

  public init(a: Int, b: Int) {
    self.a = a
    self.b = b
  }
}

let initialiser1 = print(Numbers(a: 3, b:))
let initialiser2 = print(Numbers(a:, b:))

Neither of these two compile so now I'm really confused. What's going on here?

Edit: Ok, got there in the end, seems it's a label specific syntax

func add(a : Int, b : Int) -> Int {
  return a + b
}

var add2 = add(a:b:)
print(add2(3, 4))

once I'd discovered this worked things made more sense. What's this feature called?

I think originally it was called Compound Swift Name (SE-0021), but I’ve never seen anyone actually using that name.

1 Like