[swift-evolution] [Review] SE-0084: Allow trailing commas in parameter lists and tuples
LM
laurent.mihalkovic at gmail.com
Fri May 13 02:16:04 CDT 2016
> On May 13, 2016, at 7:58 AM, Gwendal Roué via swift-evolution <swift-evolution at swift.org> wrote:
>
>
>> Le 13 mai 2016 à 07:01, Chris Lattner via swift-evolution <swift-evolution at swift.org> a écrit :
>>
>> On May 12, 2016, at 4:50 PM, Joe Groff <jgroff at apple.com> wrote:
>>>>> --- a.swift
>>>>> +++ a.swift
>>>>> foo(
>>>>> x: 0,
>>>>> - y: 1
>>>>> + y: 1,
>>>>> + z: 2
>>>>> )
>>>>>
>>>>> Trailing commas avoid this:
>>>>>
>>>>> --- a.swift
>>>>> +++ a.swift
>>>>> foo(
>>>>> x: 0,
>>>>> y: 1,
>>>>> + z: 2,
>>>>> )
>>>>
>>>> You’re arguing that you want to read Swift code written like this?
>>>
>>> I wouldn't mind it.
>>
>> I personally find that style repulsive :-) and I haven’t seen swift code commonly doing it. I’m not sure that we want to encourage it either.
>
> Don't be too harsh :-) This style can be used with much profit when there are several closure arguments:
>
> foo(
> x: {
> // several lines of code
> },
> y: {
> // several lines of code
> }
> )
>
Sorry, but this kind of code writing evokes to me the kind of stream-of-consciousness-scripting I was happy to leave behind when I quit perl (or the one *modern* Javascript is ridden with). But I get it, it is an age old psych principle that it is easier for us to ask to be enabled than it is to self-discipline ourselves. I think it is an addiction lambdas have enabled... why would I have to think about the large scale structure of what I do when I can shove a bunch instructions as a parameter. don't get me wrong, i use lambdas a lot in java, but I use method references as soon as it starts to look smell like I am about to stuff all the logic as parameters.
Regards
LM
(From mobile)
> For example: https://github.com/groue/GRDBDemo/blob/cd8b9d5cadc3c6c66fd0da4869d820c6624fdf79/GRDBDemo/PersonsViewController.swift#L12-L44
>
> Gwendal Roué
>
> _______________________________________________
> 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