[swift-evolution] commas optional

Xiaodi Wu xiaodi.wu at gmail.com
Thu Oct 12 18:20:49 CDT 2017


On Thu, Oct 12, 2017 at 2:47 PM, Jarod Long via swift-evolution <
swift-evolution at swift.org> wrote:

> I don't really expect this sort of syntactic sugar to be popular enough to
> make it through swift-evolution, and I don't think it's worth the
> distraction from more important priorities at this time, but for what it's
> worth, I've enjoyed this feature in other languages that support it. It
> plays a small part in making code more focused by eliminating unnecessary
> syntax.
>
> I could be wrong, but I'm not so sure that this would actually be source
> breaking. Even if you have something like this:
>
> let points = [
>     Point(
>         x: 1.0,
>         y: 2.0
>     ),
>     Point(
>         x: 3.0,
>         y: 4.0
>     )
> ]
>
> Proper implementation of this feature wouldn't suddenly interpret `Point(`
> as its own element.
>

There are those of us who respect the 80-character line and break
expressions across lines:

let x = [
  NSVeryVeryVeryLongType
    .veryVeryVeryLongProperty +
      NSVeryVeryVeryLongType2
        .veryVeryVeryLongProperty2,
]

It would be a pleasant surprise if a grammar with optional commas can avoid
blowing up existing code; I'm quite doubtful.


On Oct 12, 2017, 12:23 -0700, Josh Parmenter via swift-evolution <
> swift-evolution at swift.org>, wrote:
>
>
>
> On Oct 12, 2017, at 12:17 PM, Kelvin Ma via swift-evolution <
> swift-evolution at swift.org<mailto:swift-evolution at swift.org>> wrote:
>
> a semicolon is a purely syntactic delimiter, the comma on the other hand
> corresponds to physical elements in a collection. I think the two are more
> different than you suggest.
>
>
> I very much agree^
>
> Josh
>
>
>
> Joshua Parmenter | Engineering Lead, Apple Technologies
>
> T 248 777 7777 <(248)%20777-7777>
> C 206 437 1551 <(206)%20437-1551>
> F 248 616 1980 <(248)%20616-1980>
> www.vectorform.com<http://www.vectorform.com/
>
> Vectorform
> 2211 5th Ave Suite 201
> Seattle, WA 98121 USA
>
> Think Tank. Lab. Studio.
> We invent digital products and experiences.
>
> SEATTLE | DETROIT | NEW YORK | MUNICH | HYDERABAD
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20171012/193d87d7/attachment.html>


More information about the swift-evolution mailing list