No (unless I'm missing something). See @sveinhal's answer above.
For example, let's say we can currently write this:
foo(bar: .init(a: 12, b: true))
then with this pitch implemented, the following would be equivalent (via sugar):
foo(bar: (a: 12, b: true))
I'm not sure what you mean here. It would always be using the initializer directly, the same that is currently used when writing .init(…), ie
.init(width: height: ) or
.init(height: width: ).
The pitch is this:
So using your particular example, we can (in current Swift) write:
foo.bar(size: .init(width: 12, height: 34))
foo.bar(size: .init(height: 56, width: 78))
and with this pitch implemented, we'd be allowed to skip the .init-parts, and write:
foo.bar(size: (width: 12, height: 34))
foo.bar(size: (height: 56, width: 78))
Which would just be sugar for the above.
Perhaps you mean what would happen if someone (for some unknown reason) added a tuple-taking initializer? Then that initializer would be called (in current Swift) like this:
foo.bar(size: .init((width: 12, height: 34))) // or without labels:
foo.bar(size: .init((12, 34)))
which with the pitch implemented could be shortened to:
foo.bar(size: ((width: 12, height: 34)))
foo.bar(size: ((12, 34)))
(Note that it changes nothing, the double parens still make it unambiguous.)
Or what would happen if there was a foo.bar(size tupleSize: (Int, Int))? Then there would be an ambiguity error I guess, but no one would have a reason to write that tuple-variant of the method anyway.
So, ideally, this would have (next to) nothing to do with tuples, although I wouldn't be surprised if trying to implement it would open up a can of parenthesis- / tuple expression-related worms. But as I have no insight into the compiler, others would have to say whether something like that would be a show stopper or not.
Clarity is all about selectively leaving out information. If all information (no matter how detailed, obvious, well-known, context-given, etc) is spelled out everywhere, the important stuff gets lost in the noise of the less important.
We are now using .init(…) where we see it fit, because the contextual type is well-known or less important than whatever the .init- parts of those .init(…)s are still stealing attention from. The .init-parts are just the last bit of noise that the compiler forces on us.
This pitch is about letting us skip the .init-part of the .init(…)s we've already chosen to write and accept in code review. And (as explained above) it's not hard to look up the types, should it be necessary.
Yes, just as with all other shorthands in Swift (eg type inference), this shorthand would be optional and could both clarify and obscure, depending on how, where and why it is used.
Clarity in code (or communication in general) depends on us being able to focus on what's important. This is impossible without leaving out tons of contextually less important stuff. Programming and communication is about abstraction, enabling ourselves to concentrate on "higher" levels by hiding "lower" levels of abstraction. And what is relevant (higher level) in one situation can be irrelevant (lower level) in another. Abstraction (hiding) is all we do when writing code, we bundle up a lot of details behind nice types and methods etc, but that kind of abstraction can only take us so far, because (depending on the language) we can't continue abstracting beyond the limits of syntax.
I love that Swift acknowledges this, and gives the programmer / code reviewer some ability to decide syntax-wise what information is best kept in or out of some given piece of code.
Sure, we could add typealiases like V2F = SIMD2<Float>, V4F = SIMD4<Float>, RF = Rect<Float>, ... and/or we could add tuple-arg-variants of each and every frequently used initializer and method (which in my case would be something like 100+ tuple-arg-variants). There are all sorts of ways to piece together alternative and to my mind more cumbersome solutions.
: )
I will not continue "defending" the idea of this pitch, since my English skills prevent me from doing so effectively and I've already started repeating myself. It'd be nice if someone liked to have a go at implementing it in a PR so we could try it out in practice!