[swift-evolution] Allow trailing comma in guard, if-let, et al

Karl Wagner razielim at gmail.com
Fri Aug 19 12:26:10 CDT 2016


 
 
Guard wouldn't work, because the "else" is usually on the same line as the last element.
 

 
Perhaps the answer is better commenting in IDEs? So if you select a region and hit CMD+/ Xcode will comment with /*...*/ instead of sticking a // in front of the whole line.
 

 
Perhaps it could auto-expand to the complete clause if you select most of a clause in a multi-clause condition?
 

 
Karl
 
 
 Sent from my new   Email (https://itunes.apple.com/app/apple-store/id922793622?pt=814382&mt=8&ct=my_new_email)
 
 
 
 

 
 
>  
> On Aug 19, 2016 at 1:21 am,  <Rick Mann via swift-evolution (mailto:swift-evolution at swift.org)>  wrote:
>  
>  
>  
>  
> >  On Aug 17, 2016, at 18:11 , Ben Rimmington  <me at benrimmington.com (mailto:me at benrimmington.com)>  wrote:
> >  
> >  
> >>  On 18 Aug 2016, at 00:13, Rick Mann wrote:
> >>  
> >>  Is there any reason Swift can't allow a trailing comma in constructs like this:
> >>  
> >>  guard
> >>  let a = ...,
> >>  let b = ...,
> >>  let c = ...,
> >>  else
> >>  {
> >>  }
> >>  
> >>  doing so makes it a bit easier to rearrange lines, and is similar to the trailing comma allowed inside array and dictionary definitions:
> >>  
> >>  let a = [ 1, 2, 3, ]
> >  
> >  A similar proposal was rejected:
> >  
> >   <https://lists.swift.org/pipermail/swift-evolution-announce/2016-May/000171.html>
>
> Thanks. Hmm. The stated arguments seem to apply to tuples and parameter lists, not variable bindings.
>
> -- 
> Rick Mann
> rmann at latencyzero.com
>
>
> _______________________________________________
> swift-evolution mailing  list (mailto:listswift-evolution at swift.orghttps)
> swift-evolution at swift.org (mailto:listswift-evolution at swift.orghttps)
> https (mailto:listswift-evolution at swift.orghttps)://lists.swift.org/mailman/listinfo/swift-evolution
>          
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160819/88a379bd/attachment.html>


More information about the swift-evolution mailing list