A massive -1 to this proposal. Eliminating parenthesis increases readability 
and mental parse-ability.

As my own datapoint, I have 276 instances of “[^) ] *->” across 93 source files 
in one of the apps I maintain. I love that I can do “T1 -> T2” as my function 
definitions, and the ability to leave out extraneous parentheses is an impetus 
for me to structure my code differently so that my closures take a single 
parameter. It means that I use typealiases for complex parameter types.

Making this change would be a massive regression in Swift’s readability, IMO.

Dave

> On Apr 20, 2016, at 9:13 AM, Alan Skipp via swift-evolution 
> <swift-evolution@swift.org> wrote:
> 
> A quick grep showed about 50 cases of using T1 -> T2 in my current project. 
> Not a huge amount, but not tiny either. It wouldn’t be a completely dreadful 
> change to make, just irritating having to add superfluous syntactical 
> appendages to pacify the computer.
> 
>> On 20 Apr 2016, at 00:28, Jacob Bandes-Storch via swift-evolution 
>> <swift-evolution@swift.org <mailto:swift-evolution@swift.org>> wrote:
>> 
>> On Tue, Apr 19, 2016 at 3:29 PM, Dave Abrahams via swift-evolution 
>> <swift-evolution@swift.org <mailto:swift-evolution@swift.org>> wrote:
>> 
>> on Tue Apr 19 2016, Alan Skipp <swift-evolution@swift.org 
>> <mailto:swift-evolution@swift.org>> wrote:
>> 
>> > I’d place the ability to omit parenthesises for single args in the same 
>> > category
>> > as being able to omit `self` when accessing properties. They are small
>> > conveniences that make a large difference to an entire codebase.
>> 
>> Care to back that up with some measurements?  Take one of your projects
>> and find the instances of “[^) ] *->”
>> 
>> How many places in the code are affected, and how much worse is the result?
>> 
>> Here's one data point: including a small handful of false positives, I found 
>> 74 results in a project with 33 Swift files.
>> 
>> "How much worse" is hard to answer. It certainly wouldn't be the worst thing 
>> in the world to add parens, but I'm not particularly compelled by the pro-() 
>> arguments in this thread.
>> 
>> Jacob
> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution@swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to