[swift-evolution] [Proposal] Change Void meaning

Vladimir.S svabox at gmail.com
Mon Jun 12 06:21:16 CDT 2017

On 12.06.2017 11:48, Jérémie Girault via swift-evolution 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.

Could you clarify, do yo propose to change meaning of this code:
func foo() {}
from "implicitly returns Void" to "returns nothing" ?

So, this valid Swift 3 and Swift 4 code will be invalid:

func foo(){}
let x : Void = foo()

In this case I believe your proposal introduces new source breaking change that makes 
transition from Swift 3 to Swift 4 even more difficult for some code.

There were short discussions in this list if implicit Void return should also be 
removed and IIRC was rejected by common opinion or by some one's authoritative opinion.

Also, I'd like to suggest you to read text of SE-0066 proposal, where you can see 
that it clearly separated functions accepting Void parameter and accepting no 
parameters. So, IMO you should also refer to SE-0066 proposal in your text and it 
seems(correct me if I understood your proposal incorrectly) you should propose to 
revisit SE-0066 in this detail.


> 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 <http://vsre.info>
> Jérémie Girault
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

More information about the swift-evolution mailing list