[swift-evolution] Proposal: Optional Binding Shorthand Syntax

David Hart david at hartbit.com
Thu Dec 3 14:26:50 CST 2015


I understand the reasoning of this proposal but it seems to go against the objectives the Swift team has been striving towards lately of:

- simplifying the language
- making code more explicit by removed by shorthand syntax
- removing redundant syntax for achieving the same behavior 

You can see examples of this in the latest changes to the language:

- removal of the # symbol in the first argument name as a shorthand to defining the argument name twice
- removal of the ++ and -- prefix and postfix operators in Swift 3
- removal of the var modifier in argument declaration and if/guard/while/for in blocks in Swift 3

I tend to agree with their philosophy to remove these shorthand syntaxes which make the language more difficult to learn (when all these features are taken as a whole) and potentially making the grammar more complicated only for the benefit of a shorthand syntax which also has the disadvantage of allowing two different syntaxes for the same semantics.

Just my 2 cents :)



Sent from my iPhone
> On 03 Dec 2015, at 20:52, Zef Houssney <zefmail at gmail.com> wrote:
> 
> Hello. This is exciting!
> 
> I have an idea I’ve been mulling over for a while to reduce a common source of clutter in Swift code.
> 
> The idea is to introduce a new syntax for Optional Binding:
> 
> Instead of:
> 
> if let foo = foo { } 
> 
> You could simply use:
> 
> if let foo { } 
> 
> 
> I’ve written up a draft of a proposal here with additional information and motivations:
> https://github.com/zef/swift-evolution/blob/master/proposals/00xx-optional-binding-shorthand.md
> 
> 
> What do you think?
> 
> Thank you!
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution


More information about the swift-evolution mailing list