SE-0066 disallows Void to be used on left side of function types.
Some people, including me, argue that Void should be removed altogether,
because:
1) () is more consistent with curried functions: (Int) -> () -> Double
2) () follows functional programming traditions
Now, why don't we repurpose Void to follow functional programming
traditions as well?
Its definition will look like:
enum Void { }
Basically, Void is a type which cannot have values.
With it, we can eliminate at least two Swift special cases:
1. Noreturn functions
func exit(code: Int = 0) -> Void
>From this signature, it's obvious that `exit` cannot return normally
2. Rethrows
func call<T, U>(block: () throws T -> U) throws T -> U
Non-throwing functions are functions throwing Void.
So if T=Void, we get the non-throwing version of `call`.
- Anton
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution