Thanks @xedin (at least I did not misunderstood your pitch). Now... I think this particular use case (defining a default argument for Void
) should not be addressed with your pitch, because Void
is not the one and only type that could profit from a default value.
Sure, people only focused on Void
think so, because it is the problem they want to solve now. But Subject
should not jump too fast. After Void
, more needs may start to appear. See [Pitch] Type inference from default expressions - #31 by gwendal.roue
Some may answer "but send()
can only have a clear meaning when the type is Void
! So Void
is indeed privileged, and deserves a special treatment!".
Such answer only reveals the focus on Void
. For example, send()
would work just as well for Ping
:
let pings = PassthroughSubject<Ping, Never>()
pings.send(Ping()) // Obviously correct
pings.send() // Looks quite fine to me as well
So no, Void
is not special. And it should not be addressed with Type inference from default expressions. (I'm sorry for having brought this bad idea in this pitch )