[swift-evolution] [Discussion] Zero-element tuple glitch
Anton Zhilin
antonyzhilin at gmail.com
Sun Jul 3 16:47:08 CDT 2016
Vladimir.S via swift-evolution <swift-evolution at ...> writes:
> On 03.07.2016 23:53, Anton Zhilin via swift-evolution wrote:
> > let x = (Int, Int)(1, 2) //=> (1, 2)
> > let y = (Int)(1) //=> 1
> > let z = ()() // error :(
> >
> > Am I requesting too much from type checker?
>
> As I understand, because () is Void, you can't have anything additional
for
> it. It is just Void, like you write 'let z = Void Void'. I.e. only 'let
z =
> ()' allowed.
In the example, that's how I expect that to parse:
let z = ().init() // just demo, does not compile
I mean, first () is type, and second () is its initializer.
By the way, this is one thing that Void can do, but () cannot.
Are there any others?
More information about the swift-evolution
mailing list