How do you deal with lack of default generic arguments? Copy+paste?

I looked into it. Default generic arguments have not come to be. (Type inference from default expressions is related but doesn't solve this problem.)

When type is established by return value, I can't figure out how to avoid complete code duplication for overloads without introducing a useless parameter to one of the overloads.

protocol Protocol {
  static func pretendThisIsMoreInteresting() -> Self
}

func function<P: Protocol>(_: Void = ()) -> P {
  P.pretendThisIsMoreInteresting()
}
struct GoodDefault: Protocol {
  static func pretendThisIsMoreInteresting() -> Self { .init() }
}

func function() -> GoodDefault {
  function(())
}
// This is the spelling both overloads should use.
let goodDefault = function()

struct NotAGoodDefault: Protocol {
  static func pretendThisIsMoreInteresting() -> Self { .init() }
}

// This is the overload using the useless default.
let notAGoodDefault: NotAGoodDefault = function()

I guess this is better…?

func function<P: Protocol>() -> P { _function() }
func function() -> GoodDefault { _function() }

private func _function<P: Protocol>() -> P {
  P.pretendThisIsMoreInteresting()
}