This may sound like a strange request, but I have a use case where I want to be able to declare a variable or argument as “Void”, and assign a “Void” value to it. Specifically, it’s a generic class and function that passes its type through to a closure, in which Void is a sensible parameter.
' don't need to set b.value since it won't be used
Print("World "+closure())' prints 1.0
[/crayon]
Of course this won’t compile, because you can’t define Foo.value as Void, nor can you define the argument to the closure as Void.
Swift allows you to define variables as
Void, but the only valid value is
(), an empty tuple, which essentially means “nothing”. Not even
nil or
Null.
If not, I guess there’ll be a requirement to always have a return type, and exactly one argument. Also, there is method to the madness, and the nested closures are required.