Created
June 9, 2017 09:23
-
-
Save jeremiegirault/43822db33c0c5aa447c99fc3e3b0be4a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The sad state of tuples in swift 4 | |
func test() { | |
return () // why is it not mandatory ? | |
} | |
// func test() -> Void {} // error: invalid redeclaration of 'test()' why is it a redefinition ? | |
/* | |
The problem is that Void in swift is not the "Absence" of a parameter but the type of the empty tuple | |
We should change the definition to: | |
*/ | |
typealias Unit = () | |
let unit: Unit = () | |
// Void should not be considered as empty tuple but should be an intrinsic and always be flattened |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment