[swift-evolution] History and future of Swift's parentheses

Gor Gyolchanyan gor at gyolchanyan.com
Fri Jun 9 16:42:31 CDT 2017

My answer to `inout` is to promote it to a full-fledged "storage class" (in C terminology) and allow normal variables to be `inout`.
This would immediately solve the problems with `inout` being a magical thing in functions, as well as a convenient way of storing "references" (in C++ terminology) to potentially huge inout expressions, not to mention returning an inout from a function, effectively spreading the getter-setter awesomeness to everything else besides properties and subscripts.

As for variadic parameters: currently they are what I call a "dead end feature", meaning that there is no way to propagate them further and abstract them away, because you can't "unpack" a sequence into a variadic parameter (the way you can in Python with the prefix `*`), so my answer to that would also be to promote it to its own Sequence protocol conforming compiler-magic structure, which would also become part of the type system and alleviate the problem.

> On Jun 9, 2017, at 11:07 PM, David Sweeris <davesweeris at mac.com> wrote:
>> On Jun 9, 2017, at 8:12 AM, Gor Gyolchanyan via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>>> So I wonder if any of you have had any thoughts about what Swift's parentheses-related future (or evolutionary baggage) will be?
>> I really wish swift used the concept of tuples **exclusively** for all purposes that involve parentheses, as well as dividing tuples into two categories:
>> - Bare tuples, which do not have labels.
>> - Rich tuples, which do.
>> As a consequence, here's a list of statements that would become true:
>> - All functions take exactly one parameter, which is a tuple.
> That’s what we used to do. It caused problems with other language features (“inout" and “variadic" parameters were the two big ones, IIRC).
> - Dave Sweeris

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170610/79c70b5e/attachment.html>

More information about the swift-evolution mailing list