[swift-evolution] commas optional

Kelvin Ma kelvin13ma at gmail.com
Thu Oct 12 18:25:26 CDT 2017


On Thu, Oct 12, 2017 at 6:20 PM, Xiaodi Wu <xiaodi.wu at gmail.com> wrote:

> 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.
>
>
>
An argument against optional commas,, or an indictment of overly verbose
Foundation APIs… 🤔🤔🤔
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20171012/fc175860/attachment.html>


More information about the swift-evolution mailing list