[swift-evolution] [Proposal] Change Void meaning

David Hart david at hartbit.com
Mon Jun 12 11:57:35 CDT 2017


Hi there,

While I also feel it's kind of odd to have Void defined as the empty tuple with the latest changes like SE-0110, I also see issues with your proposal.

For example, your change will cause ambiguity when calling generic functions and functions that contain all the arguments but the generic one:

func foo<T>(_ a: T) {}
func foo() {}

foo() // are we calling foo() or foo<Void>()

> On 12 Jun 2017, at 10:48, Jérémie Girault via swift-evolution <swift-evolution at swift.org> wrote:
> 
> Hi here,
> 
> As I tested swift4 in xcode9b1 I noticed a lot of regressions about tuples usage.
> 
> After documenting myself about the changes which happened, I thought that they could be improved. Instead of fighting these propositions (which make sense), I wanted create a few proposal which would improve these recent changes with a few simple rules.
> 
> My propositions are based on the recent decisions and in the continuation of SE-0110. The first one is about Void.
> Void is historically defined as the type of the empty tuple. The reason of this is that arguments were initially considered as tuple. If this is no more the case, then it’s no more a reason to keep Void as an empty tuple.
> 
> I think that by having a few rules around tuples of cardinality 0 and 1 and also arguments list, we could greatly improve source compatibility and keep a lot of what makes swift great when using functional style and generics.
> 
> I drafted a proposal that would allow more source compatibility and type consistency and would enjoy discussing it with you, in order to improve it : 
> 
> https://github.com/jeremiegirault/swift-evolution/blob/master/proposals/NNNN-flatten-void.md
> 
> Let me know what you think about it,
> 
>> very short reply expected - vsre.info
> Jérémie Girault
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170612/58879f99/attachment.html>


More information about the swift-evolution mailing list